3

I'm using Opensuse Leap 42.2 and use zypper as my preferred package manager. I did regular incremental updates of my home directory to an external drive via the script:

#!/bin/bash

source="/home/florian/"
dest="/run/media/florian/My Passport A/increm-bu"
zypperfile="${source}Documents/installed-zypper-packages"
rpmfile="${source}Documents/myinstalledpackages.txt"

zypper --xmlout search --installed-only -v > "$zypperfile"
rpm -qa --qf "%{NAME} " > "$rpmfile"

rsync -avHAXS --delete "$source" "$dest"

exit 0

So I also backuped additional information of packages installed by my package manager. Now I'm having a new machine and want to migrate "as much as possible" to my new machine. So I got following questions:

  1. Is this sufficient data for a backup, that will be used to take my new machine to a state similar to my old one? I know that things like packages or bins that weren't installed via my package-manager will get lost. Also I must manually install things like my ntetwork printer again.
  2. Is it recommended to also restore (some) of the folders and files starting with a dot .. I think those folders and files are created by programs (or by myself) to save related configuration stuff. Definetly I would for example retain files in $HOME/.vim/
  3. What is the correct command to use, if my requirements are:

    Copy all files and folders except of those excluded with the --exclude option from my external drive into my new home directory (with options like in the original command, i.e. preserve hard-links, preserve ACLs, ...).

    If a new file in my new $HOME exists with an identical name, overwrite it.

    Do not delete files in my new $HOME that cannot be found in my backup.

    My idea for the script would be:

    #!/bin/bash
    
    # Adjust foldernames maybe
    source="/run/media/florian/My Passport A/increm-bu/"
    dest="/home/florian/"
    
    rsync -avHAXS  --exclude '<configuration-stuff>'"$source" "$dest"
    
     exit 0
    
  • I think this question is certainly valid although maybe more verbose than needed? From what I gather you need to know: 1. Which data do I need to backup on my opensuse system in order to be able to recover it on a new system. 2. How do I go about performing the recovery once I have said data? – Jesse_b Dec 25 '17 at 13:35
  • 1) rsync -ni... is your friend. -n will do a dry run and -v without -i leaves out too much information. Redirect output and stderr to a file or pipe it into a pager like less because there's a lot of it. 2) The new /home/florian should not be your current user home directory while this is running because then the system would also be modifying it during the transfer. – Joe Dec 30 '17 at 5:17
  • You may also want to exclude ~/.cache and (maybe) "~/.macromedia/Flash_Player/#SharedObjects". Also, make sure your old user/group numbers (not just names) are the same in both systems. – Joe Dec 30 '17 at 5:30
  • "The new /home/florian should not be your current user home directory" What do you mean by that? While I do the restore command under "3." I shouldn't run that command while in a directory under my new "/home/florian" tree? " Also, make sure your old user/group numbers (not just names) are the same in both systems". Which rsync options do I need for this? Or do I need another tool for that? – FloHe Dec 30 '17 at 11:19

Your Answer

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

Browse other questions tagged or ask your own question.