How can I migrate my existing /home/ directory to another drive?
This was I can wipe the drive it's on and install a new OS without losing anything in /home/
You are viewing a single comment
This was I can wipe the drive it's on and install a new OS without losing anything in /home/
Log in as root to avoid trying to make sure no files in
/home/
are being read/written to.Step 1: copy data to new drive. Mount new drive to
/mnt/
.cp -ra /home/* /mnt/
.-a
means that all permissions remain the same which will mean that your user can still read them. Check the man page for more details. This command will take a while. Use-v
to see progress. You should see a folder with your username appear.Step 2. Prepare
/home
for new drive. Move the files to a new folder. This is done to make sure you can still easily go back.mv /home/ /home-bak/
keep your old home dir safe in case a mistake was made.mkdir /home/
.Step 3. Mount your new drive. Mount your drive to
/home/
and check if you can login. If everything went correctly, you should be able to just login. Finally you need to update your/etc/fstab
to include this new drive. This will make sure your home drive mounts when you start your os. If everything is working, you can delete your home-bak as well.I dont like the MV home. 😅
My advice :
You can now delete or keep it as a save.
the mv home is just renaming the folder so you can mount home in the same space. Rsync is probably better than cp but I didn't want to suggest tools that op doesn't have installed.
Oh ok I see why no use of rsync. Clever.
I've read your solution, OP, you can go. Good tuto written on mobile.
This is a rough guide written on mobile. its probably best if someone double check some of this stuff before op tries it.