For this, we will assume pg1 is our current primary node and VG_POSTGRES/LV_DATA is the principal data volume. Follow these steps as the root user to create and use an LVM snapshot:
- Create the snapshot with lvcreate:
lvcreate -l 100%FREE -s -n snap VG_POSTGRES/LV_DATA
- Create a directory on which to mount the snapshot using this command:
mkdir /mnt/db_snap
- Mount the snapshot as a regular XFS filesystem using this command:
mount -t xfs -o nouuid /dev/VG_POSTGRES/snap /mnt/db_snap
- Enter the snapshot pgdata directory using this command:
cd /mnt/db_snap/pgdata
- Examine snapshot information with lvdisplay:
lvdisplay VG_POSTGRES/snap | grep snap
Follow these steps as the root user to unmount and remove an LVM ...