2

I have to move my user home to another device, it occupies several gigabytes, I would like to avoid losing something, at the moment I think I will use rsync rsync --progress -avh --remove-source-files $SRC/ $DST/, Is there anything better?

4
  • 7
    If you're afraid to lose something, then definitely do not run with --remove-source-files.
    – Kusalananda
    Commented Dec 30, 2019 at 15:45
  • 2
    I'd also double-quote "$SRC" and "$DST". If you've got extended attributes add -XX; if you've hard links add -H. Commented Dec 30, 2019 at 16:03
  • 1
    And if you have sparse files add -S. Assuming you didn't use --remove-source-files, you can use the first rsync as a test of the new device and continue using home during the transfer. Then repeat the rsync again later (add --delete to remove files on dest that are no longer on src), and you should see only the few files that changed being copied. Or you can add -c and so reread all the files for comparison.
    – meuh
    Commented Dec 30, 2019 at 17:23
  • Thanks @meuh, but I think I will do it from a pendrive with the home not mounted to avoid oddities (or booting as single user).
    – Alex
    Commented Dec 30, 2019 at 17:26

1 Answer 1

2

If you want to be on the really safe side (depending on your level of paranoia):

  1. Burn in the new device
  2. Perform surface test of new device
  3. Copy files to new device (i.e. not using the option --remove-source-files)
  4. Mount the new device in its intended place and make sure everything works correctly
  5. Only when everything works fine, discard the source files.

In case you would rather keep a backup of the source you could instead of using rsync for copying in point 3 create a tar archive of your home, extract that to the new device, and keep the archive when discarding the old device.

2
  • 1
    I used tar -c | tar -x in the past but in this case I prefer an incremental copy in case of interruption. I think rsync is the way to go, I was looking for a confirmation, I wanted to understand if there can be problems with named pipes, sockets, symbolic links, hard links, permissions (other unexpected ...).
    – Alex
    Commented Dec 30, 2019 at 17:25
  • 1
    In the end I used rsync -a -H --info=progress2 /src/ /dest/ --delete (booting in single user) in multiple sessions and everything seems fine, the copy was very slow (the /src/ disk is slow), I spent some time between sessions to delete several cache files from /src/
    – Alex
    Commented Jan 9, 2020 at 9:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .