0

I would like to request information on using rsync. I tried reading the manuals, but the examples are few and confusing for me.

I do not need advanced features or live sync or remote sources or remote destinations. Everything is with ext4. Just using my laptop's HDD and an external HDD over USB. On Ubuntu.

My ultimate object is to move the contents of my /home to an external drive. Wipe my laptop, switch it to LVM, re-install Ubuntu, update, install same programs I had before, then boot a live USB and copy the contents of my backed up /home (now on my external HDD) onto the /home of the new installation (installed with same username and UID as last time).

I would like to keep all permissions and ownership the same.

I tried copy-pasting everything onto the external drive, but I got error messages. I know that doing a copy-paste from the GUI on a live USB will change everything to root ownership (which would be double plus not good).

I see all of these flags in the man page ... and all I understand is

rsync /home/jonathan /media/jonathan/external-drive/home/jonathan

from

rsync /source/file/path /destination/file/path

I already use this hard drive to back up most folders and big files like Movies, etc. Is there a way to copy-paste what I want, while saving permissions, and only adding the hitherto ignored .config files and only changing changed files? I would like to be able to do this manually about once a week to back up settings AND my personnel files in case I ever need to reinstall in an emergency or my hard drive fails.

  • Maybe I do not fully understand your question... but this all seems like a simple file copy, even if you are copying whole /home. What's the point of doing it while booted on live distro while you can do it while your installed system is running? – Fiisch Mar 26 '20 at 19:26
  • Simply put, I am not just backing up and restoring stuff like papers, audio and video content and various user files. I also want to copy and retain all of my configurations, from GnuPG to the desktop settings. 1. Certain files will not copy. I get error messages. 2. I would like to copy all of my program settings, saved e-mails, Firefox settings and so forth. 3. In the past I tried copy-pasting my config files for things like Firefox, etc. and that failed. 4. Many files change. Rather than delete my backup and then copy-paste all over again, I only want to copy-over changed files. – Jonathan Joseph Chiarella Apr 9 '20 at 0:36
  • Thanks. My reaction was mainly to the first part of your question - about moving data and wiping the ntb. For the second part, just use what Mark Stewart wrote. And maybe have a look at --delete-SOMETHING options of rsync to perform real data mirror. If you want to retain backups to some time in the past, maybe rdiff-backup could suit you better. – Fiisch Apr 9 '20 at 6:58
0

Here is a quick rsync setup and what it does.

rsync -avz /home/jonathan /media/jonathan/external-drive/home/jonathan

This will recursively copy the files, preserve attributes permissions ownership etc. from /home/jonathan to the external folder.

for safe keeping you could also do a tar to get everything together and then send one file over.

tar zcvf /media/jonathan/external-drive/home/jonathan/jonathansFiles.tgz /home/jonathan

then uncompress later.

tar zxvf jonathansFiles.tgz
  • 2
    The rsync -z flag is ignored when copying locally – roaima Mar 27 '20 at 8:50
  • Thank you, Mark Stewart. This worked. – Jonathan Joseph Chiarella Apr 26 '20 at 21:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.