LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How can I replace /home on one drive with a different /home from another? (https://www.linuxquestions.org/questions/linux-newbie-8/how-can-i-replace-home-on-one-drive-with-a-different-home-from-another-4175615024/)

Sol33t303 10-04-2017 08:51 AM

How can I replace /home on one drive with a different /home from another?
 
I recently had to wipe my SSD and before doing so I backed up my /home partition to another drive (sdc3) and reinstalled fedora on my SSD (sda3). I don't want to change /home to the one on my backup drive because that would mean I would have to deal with HDD speeds when I could be using my SSD. How can I replace /home (on sda3) with /home (on sdc3)? So to make things clear, I don't want to set use the /home on sdc3, I want to use the /home on sda3 but with all the contents of sdc3. I'm not really that new to Linux (have been using it for 10-11 months) but I feel this is sort of a noobish question. Also, previously before the wipe I had my /home on a separate partition but don't any more making replacing it a bit more complicated I would imagine.

pan64 10-04-2017 09:01 AM

you can use for example the tar command to pack the content of home (on sdc3) and unpack it onto the other drive.
Code:

# use soemthing like this - as root
tar -C sourcedir -cf - . | tar -C destdir -xf -

You may use rsync too (and other tools). But you need to take care about user id (if that changed) and also you may need to check if there was some special settings in /home before.

sevendogsbsd 10-04-2017 09:38 AM

Rsync is a good solution as pan64 mentioned - works well. If you use the tar method suggested, make sure the ownership on /home is set correctly for your user or you won't be able to log in.

Rickkkk 10-04-2017 12:00 PM

I would honestly just install the distro with a fresh, empty home for my user, and copy the contents (not the "home/<myuserid>" directory itself ...) of the backed-up home into the new "/home/<myuserid>".

Done this several times in exactly the same circumstances as you describe.

Hope this helps - let us know how you make out !

Cheers.


All times are GMT -5. The time now is 05:02 AM.