1

I have 2 drives on my machine, but one is unused. I would like to use the unused drive for the home partition (as in moving my current home directory into the unused drive). Is this possible without reinstallation and if so how do I go about doing it?

1 Answers1

2

During this process, you should avoid using directory /home by any application, so it's best to not login from GUI, but from the text console (available after pressing Ctrl+Alt+F3 key).

Perform everything with root permissions (run sudo -i first).

Create a partition on the unused drive (using fdisk) and format it (create a filesystem) using mkfs.

Rename directory /home to /old_home. Create a new, empty directory /home, with the same owner and permissions as /old_home.

Mount the new partition you just formatted under /home, For example if the new partition is /dev/sdb1, use the command mount /dev/sdb1 /home.

Copy everything from /old_home to /home, preserving ownership, permissions etc. (you may use rsync for that as mentioned in the comment above: rsync -a /old_home/ /home/).

Edit /etc/fstab file so that your new /home will be automatically mounted when the system reboots. Your /etc/fstab currently contains a line for the drive you are already using, it might be something like this (I'm making this one up now, yours may be different):

/dev/sda1 / ext4 defaults 0 1

Add a similar line for your new partition that says for example:

/dev/sdb1 /home ext4 defaults 0 2

(if your file has something else instead of "defaults" just copy these parameters to the new line).

Reboot your system (shutdown -r now) and after reboot check if everything is working properly (ie. everything that should be under /home is there). If yes, then delete the /old_home directory - it's not needed anymore.

raj
  • 11,409