How to create a separate home partition after installing Ubuntu under single / partition [duplicate]
I have got a dual boot system here with a couple of partitions:
- Windows 7 OS partition
- Another partition for office data
- One partition for Ubuntu
- And of course one 100Mb partition auto-made by Windows
- And just like Windows one swap partition by Ubuntu
Of course, I wanted to have a separate partition for /boot
and /home
which I have not got here, so I would like to do that if it’s possible.
Can I install GParted in my system and create a new partition by shrinking my existing /
partition, then mount /home
under it somehow? I don't want to mess up my system. Some concrete advice required here.
Solution 1:
If you don’t create a separate home partition while installing Ubuntu, you don’t have to reinstall Ubuntu from scratch. To migrate to a separate home partition after installation, you’ll have to create a new partition (which may require resizing your existing partitions), copy the files from your existing home directory to that partition, and tell Ubuntu to mount the new partition at /home.
- Create a New Partition : use Gparted to shrink and create new partition. Here a tutorial for you.
-
Copy Home Files to New Partition : copy your files from old home to the newly created partition
sudo cp -Rp /home/* /new-partition-mount-point
-
Get your new Partition’s UUID: use the command:
sudo blkid
Copy the UUID to add it later to the
fstab
-
Add to the fstab:
sudo gedit /etc/fstab
Add the following text to the fstab file on a new line
UUID=New-partition-UUID /home ext4 nodev,nosuid 0 2
-
Move Home Directory & Restart
Move your current home directory, and create a new, empty home directory which your new partition will be mounted at:
cd / sudo mv /home /home_OLD sudo mkdir /home
Now restart and check your new configuration, If everything is just perfect then you can completely remove your old home.
sudo rm -rf /home_OLD
For details and more information refer to the Ubuntu wiki: https://help.ubuntu.com/community/Partitioning/Home/Moving