Keep your symlinks from turning into actual file duplicates

Backup & Recovery (Rsync/Tar/Dd)

Keep your symlinks from turning into actual file duplicates

🧩 The Challenge

Backing up a directory with a bunch of symlinks often results in rsync pointlessly copying the target file over and over again, filling up your disk before the job even finishes. I’ve blown through my storage quota more than once because I forgot how rsync treats soft links by default.

💡 The Fix

Use the specific flags that tell rsync to preserve the link itself rather than following the path to the actual file. It saves space and stops your backup from turning into a recursive nightmare.

rsync -av --no-links --safe-links /source/ /destination/

⚙️ Why It Works

Setting these flags instructs the utility to ignore symlinks that point outside the source tree while keeping the link structure intact inside the backup. It avoids the recursive expansion that usually eats all your inodes.

🚀 Pro-Tip: Always dry run with the –dry-run or -n flag first unless you enjoy cleaning up messes at 3 AM.

Linux Tips & Tricks | © ngelinux.com | 11/4/2026

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted