Shared snapshots

Yesterday I bought an external hard-disk for backups. To make the backups I’ve rolled my own script (snapshot.sh) that uses rsync to make a snapshot of my home-partition and transfer it to the external hard-disk. The interesting part is, that the script takes advantage of the rsync option --link-dest to share a large part of the snapshots using hardlinks.

So after making three snapshots du -sh tells us that the snapshots takes up 25.3 Gb of disk space:

8.5G    /mnt/external/vips-backup/snapshot.0
8.4G    /mnt/external/vips-backup/snapshot.1
8.4G    /mnt/external/vips-backup/snapshot.2

However, df -h tells us that only 8.6 Gb of the external hard-disk is used:

/dev/sda1             187G  8.6G  179G   5% /mnt/external

Nifty, and with just 40 lines of bash scripting.

Leave a Reply

Your email address will not be published. Required fields are marked *