How it works...

We can use the same lvcreate utility that helped us provision the PostgreSQL volume. We start the command with the -l parameter set to 100%FREE to use any unallocated space in the VG_POSTGRES volume group. While we can specify sizes in MB or GB with the -L setting, we really only need to do this if we plan on creating multiple snapshots.

The -s parameter makes this volume a snapshot, which causes LVM to base its contents on those of another volume. Thus, we specify VG_POSTGRES/LV_DATA as the origin volume group and volume we want to use for the snapshot. We also use the -n parameter to set the name of the new volume to snap, making our intentions more obvious.

With the volume created, we simply need to mount it to access the ...

Get PostgreSQL High Availability Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.