docs(site): Add LVM example for actions (#3286)

* Add LVM example for actions

* Fix wording of LVM example
This commit is contained in:
Christoph Hecht
2023-09-11 04:45:19 +02:00
committed by GitHub
parent aa064bb442
commit 3257abbd17

View File

@@ -141,6 +141,38 @@ rmdir /mnt/$KOPIA_SNAPSHOT_ID
zfs destroy $ZPOOL_NAME@$KOPIA_SNAPSHOT_ID
```
### LVM Snapshots:
When snapshotting filesystems using LVM snapshots, we must first create a LVM snapshot using `lvcreate` and mount the filesystem inside the LVM snapshot somewhere.
Then we tell `kopia` to snapshot the mounted directory instead of the current one.
Make sure to match the snapshot size with your requirements. The snapshot grows with the delta to the origin logical volume.
You also need to make sure to have enough free space in your volume group, otherwise the snapshot creation will fail.
After snapshotting, we need to unmount and remove the temporary logical volume using `lvremove` command:
Before:
```shell
#!/bin/sh
set -e
VG_NAME=vg0
LV_NAME=lv-root
SNAPSHOT_SIZE=10G
lvcreate -L ${SNAPSHOT_SIZE} -s -n $KOPIA_SNAPSHOT_ID $VG_NAME/$LV_NAME
mkdir -p /mnt/$KOPIA_SNAPSHOT_ID
mount /dev/$VG_NAME/$KOPIA_SNAPSHOT_ID /mnt/$KOPIA_SNAPSHOT_ID
echo KOPIA_SNAPSHOT_PATH=/mnt/$KOPIA_SNAPSHOT_ID
```
After:
```shell
#!/bin/sh
VG_NAME=vg0
umount /mnt/$KOPIA_SNAPSHOT_ID
rmdir /mnt/$KOPIA_SNAPSHOT_ID
lvremove -f $VG_NAME/$KOPIA_SNAPSHOT_ID
```
### Windows shadow copy