My install had the /home folder inside /. I wanted to add a separate /home partition, so I created a small backup partition on a different drive, added it to /etc/fstab, and used rsync
with -aXS
to move my old /home folder to this new partition. I then did a fresh install with a /home partition. Now I would like to move my files back from the old /home folder into the new /home directory. What is the best way to do this?
What I tried: sudo rsync -aXS /home_backup/. /new_home_partition/.
as per this guide
This copied the old /home folder itself into the /home partition (i.e. it created /home/home), which is not what I wanted. I figured I could run the same command, but on the subfolders within the backup folder rather than on the folder itself. Is this the best way to go about it?
I saw this similar question, but as I understand it, cp
will not preserve information like permissions and links. I also saw this question, but I don't know how to work with tarballs (and I'm not positive the OP's situation is the same). Any help would be appreciated, as I'm by no means an expert!
P.S. What is the best command to remove all files from the fresh /home partition before copying the backup files into it?
Edit: Looks like I was able to resolve this, but I still don't know what happened (added a comment below).
rsync
command complete? If so, then rename/home
to/home2
. Thencd /home2/home/; mv * ..
. Since its all on the same file system, the move will be instantaneous. Don'trsync
orcp
again. That will take time. – Ray Aug 30 '21 at 02:53cp
will preserve permissions, links - if you tell it to. Me, I'd just copy the files, then run adiff
before Irm
. Depending on what is there, I may also usersync
, but we've got few details of what number of files are involved (hundreds, thousands, millions etc) nor size of files (MB, GB, TB..) etc so it's to me opinion as to best method. I'd also likely use a live system to perform it; but again I don't have details that would dictate if that's what I'd use... – guiverc Aug 30 '21 at 03:01/home/home
folder. So I guess you must have hadhome
folder inside your/home_backup
. If this is the case, just use/home_backup/home
as a source argument to yourrsync
command instead of just/home_backup
. – raj Aug 30 '21 at 10:11