diff --git a/site/content/docs/Advanced/Actions/_index.md b/site/content/docs/Advanced/Actions/_index.md index c57d3e9b4..8f8730ab9 100644 --- a/site/content/docs/Advanced/Actions/_index.md +++ b/site/content/docs/Advanced/Actions/_index.md @@ -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