File System Snapshots - Paiet/Tech-Journal-for-Everything GitHub Wiki
- Install Snapper
- Create a thin provisioned LV storage pool
lvcreate --thin vg1/pool1 --size 500G
- Create LV that will require snapshots and mount it
lvcreate --thin vg1/pool1 --virtualsize 50G --name website
mkfs.ext4 /dev/vg1/website
mkdir /website
mount /dev/vg1/website /website
semanage fcontext -a -t httpd_sys_content_t /website
restorecon /website
- Create a Snapper configuration file
snapper --c website create-config --f "lvm(ext4)" /website
less /etc/sysconfig/snapper
less /etc/snapper/configs/website
ls -la /website
- Look for
.snapshots
folder
- Take a snapshot prior to a change
snapper --c website create --t pre
- Take a snapshot after making the change
snapper --c website create --t post --pre-num 1
- Is assigned a snapshot number, but it still tied to the "pre" snapshot
- Use
snapper --c website list
to determine snapshot number
- View the files that changed
snapper --c website status 1..2
c
= File changed
+
= File added
-
= File deleted
- View the actual differences in a file
snapper --c website diff 1..2 /website/index.html
- Undo changes
- Individual file
snapper -c website -v undochange 1..2 /website/index.html
- The entire snapshot
snapper -c website -v undochange 1..2
- Delete snapshots
snapper -c website delete 1
snapper -c website delete 2