Cheap daily snapshots with rsync and hard links
--link-dest makes every snapshot look like a full copy while unchanged files cost only a directory entry.
rsync -a --delete --link-dest=/snap/latest /data/ /snap/$(date +%F)/
ln -sfn /snap/$(date +%F) /snap/latest
Things that bite
- Hard links share metadata. A
chmodon one snapshot changes them all. - Renaming a large directory makes the next snapshot a full copy.
- Inode exhaustion arrives before disk exhaustion on small-file trees. Watch
df -i.
Pruning
Deleting an old snapshot is just rm -rf. Data is freed only when the last link goes, so keep a few weekly ones and the space cost stays small.