brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: rsync --link-dest makes daily backup snapshots that only cost the changed files

Backup
~/tips/tip-rsync-link-dest-snapshots

rsync -a --link-dest=../2026-11-25 /src/ /backup/2026-11-26/

Makes full daily backup folders where unchanged files are hard links, so they take almost no space.

I like backups where every day is a complete folder I can browse, without paying the disk space of a full copy each day. rsync can do that with one option.

--link-dest=DIR compares the source with an older backup. Files that did not change are hard-linked from that folder instead of copied again. Only new and changed files take real space.

rsync -a --link-dest=../2026-11-25 /src/ /backup/2026-11-26/

A relative DIR is relative to the destination, so ../2026-11-25 here means /backup/2026-11-25. That trips people up. If in doubt, give an absolute path, like the example in the man page does.

Every dated folder now looks like a full copy. Deleting an old one only frees the files that no other snapshot links to, which is how a hard link works. A small script that puts in today’s date and yesterday’s folder name gives you rolling snapshots.

Caveats. Files are only linked when their attributes match, so permissions and ownership have to be preserved (-a does that). If nothing seems to be linked, check those first. The man page also says it works best when you copy into an empty destination, so always start a new dated folder. And a snapshot is only as safe as the disk it lives on: hard links on the same drive are not a second copy. I’d do a dry run with -n the first time.

Further reading: rsync manual: –link-dest, On this site: rsync -ani shows what would change before it changes anything

More Backup tips restic snapshots --group-by host,paths mysqldump --routines --events mydb > mydb.sql rsync -a --files-from=list.txt /home/me/ backup:/backup/ restic find "*.txt" restic stats All Backup tips (45) All topics

Link