Having entirely different partition for ‘/home’ is always beneficial. As home is the directory where all your Media and Documents are. By keeping ‘/home’ inside ‘/’ there is a possibility that with switching to new Linux Distro might cause loss of data however in Ubuntu to Ubuntu Switch it does not happen. But if you add a new HDD and wants all your data to be shifted in new Volume it becomes cumbersome to every time to mount and manage the data. So here are some steps which you need to follow to move ‘/home’ to new partition.
Copy your ‘/home’ to new Partition:
Open your Terminal and Run
df -h | grep ^/dev
This will give you list of all the Partitions mounted in. Copy the path of the desired partition (it will be /media/LABEL_NAME). Then copy your home folder to desired partition.
$ sudo rsync -axS --exclude='/*/.gvfs' /home/. /media/LABEL_NAME/.
Reason why we are using ‘rsync’ instead of ‘cp’ to copy the contents is that ‘rsync’ maintains permissions also.
Find out the uuid of the Partition:
UUID stands for Universal Unique Identifier, and every partition has its own uuid.
$ sudo blkid
This is will give you output similar to shown in this Snapshot. Copy the UUID of the Partition you want your ‘/home’ to be in and keep in my mind the type of Partition (I.e ext3, ext4, ntfs)
Prepare the switch :
Before moving ahead make sure to take a copy of ‘fstab’. Run-
$ sudo cp /etc/fstab /etc/fstab_bckup
Now open ‘/etc/fstab’ with your favorite text editor
If you are good with vim the do
$ sudo vim /etc/fstab
gksu gedit /etc/fstab
Add following line in fstab-
UUID=???????? /home TYPE nodev,nosuid 0 2
where ‘?????’ is the uuid of your partition and type is a type of partition (ext3, ext4 etc.) Save it and close it.
Now you are ready to switch but before that we have taken backup of ‘/home’ and need to empty it.
Follow Sequence of commands –
$ cd / $ sudo mkdir /home_bckup $ sudo mv /home /home_bckup $ cd / $ sudo mkdir -p /home
Now you have backup of ‘/home’ and ‘fstab’ so its time to reboot. If you have followed instructions properly then next time when Log in everything will be the way you had earlier. Make sure everything is working properly. If you have applications like Dropbox then you might have to reconfigure it (It will be prompted by Dropbox itself) so that Dropbox will re-index your directories.