convert the home directory to partition on linux 1

How to Convert the Home Directory to Partition on Linux

Convert the home directory to partition on Linux seamlessly whenever you want to. It will help you stop worrying about losing your files inside the home directory whenever the system faces an unavoidable crash or a similar situation.

It might not be usual for many, but folks like me always have thought of converting the current home directory to a separate partition. The main intention is to safeguard the existing files during a sudden system crash. Luckily, doing that is a genuine possibility.

Pre Requisites

You’ll need an additional disk to convert the home directory to partition. I’ll be using a removable USB drive to serve this tutorial’s purpose. So make sure you’ve one for you sorted. 

How to Convert the Home Directory to Partition on Linux

Considering that you’ve your additional disk ready, it is time to learn how to convert the home directory to partition on Linux. With a view of helping you understand better, I’ve sectioned this guide into the following section:

Step 1: Identifying the New Drive that you’ve Added

Start by identifying both your current home partition and the added drive. Have a glance at the configuration of your single hard drive by invoking the df command in the following manner:

$ df -Th
identifying new drive

Once done, plug in the external drive (removable USB in our case) and verify if it is identified as /dev/sdb. The same must be mounted on /media/LinuxPC/removabledrive. Confirming is pretty easy; just run the lsblk command and study the output.

Step 2: Creating a New Linux Partition

After the verification process, the next step is creating a new Linux partition. In case you don’t know, a new drive doesn’t have a partition of its own. With that being said, adding a new drive isn’t enough; it is crucial to create a fresh partition to use the same as a distinct home directory.

Verifying Partition Availability

Still, you can verify if the newly added drive packs a partition already. Launch the Terminal by using the “Ctrl+Alt+T” key combination and invoke the fdisk command.


$ sudo fdisk -l
verifying partition availibility

Study the output and look for the section that talks about the availability of the partition associated with the new drive.

Creating a New Partition

To create a new partition, use the fdisk command in the following manner:

$ sudo fdisk /dev/sdb

You’ll then come across a prompt that asks to input “n” for creating a fresh partition. Press “n“, and you’re done. After that, use the “p” and “1” keys to assign the partition a primary tag and specify the same with partition number. Finally, hit the “Enter key” and accept the default prompts.


To make sure all the changes have been successfully applied, run the $ sudo fdisk /dev/sdb command and press “p” on your keyboard when prompted. The output should mention the new partition; if not, repeat the process until now.

Step 3: Formatting the New Linux Partition

As soon as the creation part concludes, we get into the formatting part. Here you’ll format the corresponding /dev/sdb partition by employing the ext4 system format (mkfs command). It is crucial to remember that we’ll format the partition, not the removable drive during the process.


$ sudo mkfs.ext4 /dev/sdb
convert the home directory to partition

Step 4: Mounting the New Partition

Setting up the drive and partition is almost done; however, the drive is still not accessible. To make that happen, you need to conclude the mounting process. 

Creating a Mount Point

Pass the mkdir command alongside the -p flag to create a mount point.

$ sudo mkdir -p [directory]

Mounting the Partition

Use the mount command in the following manner and get the job done:

$ sudo mount /dev/sdb [directory]


Before moving any further, use the df command and verify that the mounting has successfully concluded.

Step 5: Copying the Home Directory Files

You’re now ready to copy the files sitting on your home directory and paste those in the newly created partition. 

Run the following command:

coping home directory files

Check the content by invoking the ls command in the following manner:

convert the home directory to partition

Step 6: Creating a New Home Directory

It might come as a surprise, but you’ll need to create another fresh home directory. To avoid confusion, make sure to have a distinct name for that.

$ sudo mv /home /
creating new home directory

Run the following command to create a new home directory:

$ sudo mkdir /home

After that, unmount the previous drive and mount the new one.

Unmount: $ sudo unmount /dev/sdb

Mount: $ sudo mount /deb/sdb /home

Confirm that the home directory loads with all the desired files using these commands:

$ co /home
$ ls -l arbas

Step 7: Mount the Partition Permanently

The final step is to convert and mount the partition permanently. This will help ensure that every time your system boots up, the entire file system gets mounted on the new partition. For that, you’ll need to modify the /etc/fstab file.

Before doing that, grab the UUID of the concerned system by invoking the blkid command.

convert and mount partition

Open the /etc/fstab file using vim and append the existing uid with the new UUID (the one you’ve grabbed earlier)

Save the file and proceed.

That’s how you can convert the home directory to partition on Linux. The process is pretty simple, but you’ll need to maintain a cool head throughout. I’ve presented the exact requirements in this tutorial in the most structured manner.

If this guide helped you, please share it.

Leave a Reply
Related Posts