Backup & Recovery (Rsync/Tar/Dd)
Don’t lose your directory permissions when moving backups
🧩 The Challenge
You finally moved that massive terabyte directory over to the offsite storage server, only to realize later that all the ownerships are mapped to your local UID and the permissions are a total train wreck. I’ve spent an entire night fixing chown errors after a backup because I forgot one single flag.
💡 The Fix
Start using the archive mode with rsync, which is basically a shorthand for all the flags you actually need to keep the metadata sane. It makes sure you aren’t just copying data, but actually cloning the environment.
rsync -avxHAX --numeric-ids /source/directory/ /destination/directory/
⚙️ Why It Works
The magic here is the combination of archive mode, hard-link preservation, and numeric-ids. By forcing the numeric IDs, you ensure that even if the remote server has different users mapped to those numbers, the files stay owned by the correct IDs on the disk.
🚀 Pro-Tip: Always do a dry run with the –dry-run flag before moving the big stuff.
Linux Tips & Tricks | © ngelinux.com | 10/29/2026
