Stop rsync from nuking your backup metadata when moving between filesystems
Backup & Recovery (Rsync/Tar/Dd)
Stop rsync from nuking your backup metadata when moving between filesystems
🧩 The Challenge
You finally move your project assets to a new storage volume, only to find the owner, group, and permissions are all trashed. It turns out rsync defaults to your current user and environment if you aren’t careful, and I’ve lost way too many weekends fixing that mess after a migration.
💡 The Fix
Use the archive mode flag to keep your permissions and ownership intact, and add the numeric IDs flag to ignore the local user mapping nightmare.
rsync -aHAXn --numeric-ids /source/path/ /destination/path/
⚙️ Why It Works
Adding the -a flag bundles up the recursive, link, and permission-preserving magic, while –numeric-ids ensures you don’t end up with random user IDs just because the UID 1000 on your laptop is different from the UID 1000 on the server. The -n flag is your safety net to do a dry run before you actually trigger the transfer.
🚀 Pro-Tip: Always run it with -v for verbose output during your dry run so you can see exactly which files are going to be touched.
Linux Tips & Tricks | © ngelinux.com | 7/27/2026
