Using rsync to back up /home folder with same permissions, recursive

Solution 1:

The easiest way to do this would be to use a live USB and use the -a flag for rsync.

This flag (I think -a stands for archive) preserves all the file and folder attributes, including permissions.

Once you're in a live session, plug in your external drive and use sudo blkid to see which drives correspond to which devices in /dev. You might find that your live USB is /dev/sda, while your laptop's HDD is /dev/sdb, and perhaps your external drive is /dev/sdc. I'll pretend for the example that those are the drive names but yours may vary.

Make subfolders for your laptop and external drives:

sudo mkdir /mnt/laptop
sudo mkdir /mnt/external

Then mount the drives and create a folder in your external drive if it doesn't exist:

sudo mount /dev/sdb /mnt/laptop
sudo mount /dev/sdc /mnt/external
sudo mkdir /mnt/external/home

Then use rsync to copy the data in archival mode:

sudo rsync -av /mnt/laptop/home/jonathan /mnt/external/home

Make sure you don't use a trailing slash in the origin folder name, so that rsync creates it for you with the right permissions.

Move to the folder in the external drive:

cd /mnt/external/home/jonathan

And check that the file permissions were preserved with ls -la.

Good luck!