Backup a Linux machine with LVM Snapshots and rdiff-backup

Here is the completed script I wrote on Episode 461. Make sure you check out the full episode for details on how to make this work for you.

#!/bin/sh
/sbin/lvcreate -L10G -s -n lvm_snapshot /dev/ubuntu-mate-vg/root
/bin/mount /dev/ubuntu-mate-vg/lvm_snapshot /mnt/snapshot

/usr/bin/rdiff-backup -v5 --print-statistics \
  --exclude /mnt/backup/ \
  --include /mnt/snapshot/home/ \
  --include /mnt/snapshot/etc/fstab \
  --include /mnt/snapshot/var/log/ \
  --exclude '**' \
  / \
  /mnt/backup/

/bin/umount /mnt/snapshot
/sbin/lvremove -f /dev/ubuntu-mate-vg/lvm_snapshot

And of course, here is the episode:

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments