Backup & Recovery (Rsync/Tar/Dd)
Stop tar from stripping your hard links and wasting your storage
đź§© The Challenge
You’ve finally set up a solid backup script, only to realize your multi-gigabyte deduplicated files are taking up double the space on the destination. It turns out tar likes to be “helpful” by following links or breaking them instead of preserving your hard link structure.
đź’ˇ The Fix
Just toss the hard-link flag into your archive command and watch your disk usage drop back to reality. It forces tar to record the link instead of the actual data, which saves you a massive headache on your backup server.
tar --hard-dereference -cvzf backup.tar.gz /your/data/path
⚙️ Why It Works
By default, tar treats linked files as separate entities, but adding this flag tells it to look at the inode and store the reference instead. It’s the only way to keep your storage footprint sane when you’ve got a lot of mirrored data.
🚀 Pro-Tip: Always run a test extract with the –list flag first so you can verify the links actually point where you think they do.
Linux Tips & Tricks | © ngelinux.com | 8/3/2026
