Backup & Recovery (Rsync/Tar/Dd)
Keep your file metadata when backing up to external drives
đź§© The Challenge
You finally dragged yourself to back up that home folder to an external drive, only to find later that the permissions are completely trashed because you forgot the right flags. It’s infuriating to realize you have to do the whole transfer over because now your files are owned by the root user of your backup machine instead of your local account.
đź’ˇ The Fix
Use rsync with the archive flag to ensure your user IDs, groups, and timestamps stay exactly where they belong. It makes the backup mirror look and feel like the original data source.
rsync -avhP /source/directory/ /destination/directory/
⚙️ Why It Works
Adding the -a flag triggers archive mode, which effectively bundles all the necessary flags to preserve symlinks, permissions, ownership, and modification times. You end up with a bit-for-bit mirror instead of a pile of generic files that have lost their history.
🚀 Pro-Tip: Always toss in the –delete flag if you want your backup to actually track deletions instead of just accumulating junk forever.
Linux Tips & Tricks | © ngelinux.com | 11/3/2026
