Partitioning a Hard Drive for Separate Home - TUXEDO Computers

  ATTENTION: To use our store you have to activate JavaScript and deactivate script blockers!  
Thank you for your understanding!

Partitioning a Hard Drive for Separate Home

Please note: A backup of the important data should be created beforehand, as something can always go wrong.No reinstallation is required for this method, provided there is enough space on the disk.

 

To make this change in the partitioning scheme of your hard drive, you need a live Linux system to boot from (e.g. from a USB stick). After the live system is ready, "gparted" (Gnu Partition Editor) must be started.

Please select the internal hard disk (top right):

/dev/nvme0n1Subsequently, mark the second partition:

( /dev/nvme0n1p2)

Change the partition with a right click and "Change size". Tip: The root partition should ideally have at least 60 GB!

The swap partition is then moved to the left (again with right click - resize).

Then create the new /home partition in the resulting free space as "ext4" (right click - New).

Now open a terminal and grant yourself root rights:

$ sudo su -Now create two directories where the existing / (root) partition and the new /home partition are mounted:

mkdir /mnt/nvmeroot
mkdir /mnt/nvmehome
Both partitions can then be mounted:

mount /dev/nvme0np2 /mnt/nvmeroot
mount /dev/nvme0np4 /mnt/nvmehome
Inventory data (of all users) can now be copied to the new /home:

rsync -avlHA /mnt/nvmeroot/home/. /mnt/nvmehome/To include the new partition into the fstab file, the unique UUID (Universally Unique Identifier) is required. You can find the corresponding UUID of the new /home partition with:

ls -l /dev/disk/by-uuid

The new UUID is then marked and copied for later.

Then the new /home partition is added to the existing /etc/fstab:

nano /mnt/nvmeroot/etc/fstabA possible line with standard mount options looks like this:

UUID=[copy UUID here] ext4 /home defaults, relatime 0 0You can find more mount option for fstab here.

Partitions can be unmounted at this point:

umount /mnt/nvmeroot
umount /mnt/nvmehome
The system can now be restarted, then check in the terminal if everything worked:

$ mount

There must be a line that names the /home directory, such as:

/dev/nvme0n1p4 on /home type ext4 defaults,relatime

Note: The data in the old /home directory still exists. These can be deleted by deleting the contents of the /home directory (not the folder itself). To achieve this, start the live system again, mount the / (root) partition and delete the contents of the /home directory:

In a terminal you issue these commands to delete the files in the old /home: 

$ sudo su -
mkdir /mnt/nvmeroot
mount /dev/nvme0n1p2 /mnt/nvmeroot
rm -rf /mnt/nvmeroot/home/*