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?
1 Answer
If you want to be on the really safe side (depending on your level of paranoia):
- Burn in the new device
- Perform surface test of new device
- Copy files to new device (i.e. not using the option
--remove-source-files
) - Mount the new device in its intended place and make sure everything works correctly
- 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.
-
1I 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 ...).– AlexCommented Dec 30, 2019 at 17:25 -
1In 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/– AlexCommented Jan 9, 2020 at 9:56
--remove-source-files
."$SRC"
and"$DST"
. If you've got extended attributes add-XX
; if you've hard links add-H
.-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.