Add Additional Hard Drive

This tutorial explains how to expand your system with another hard drive and add an automatic mounting rule.

Create Partition

First you need to partition your hard drive. The best tool for the job is gparted. If necessary install gparted with

sudo apt-get install gparted

For the use of gparted sudo rights are necessary

sudo gparted

As file system choose ext4.

Create a Mount Point

The mount point is a directory from which it is possible to access the content of the hard drive. We recommend a mount point with /media because it’s Ubunutu’s default. For this example /media/MyNewDrive will be our mount point.

sudo mkdir /media/MyNewDrive

Mount Partition

Assuming you want to mount the hard drive automatically each time you boot your computer you need to edit your /etc/fstab. This file contains the necessary information to automate the process of mounting partitions. The syntax of the fstab file is as follows:

[Device] [Mount Point] [File System Type] [Options] [Dump] [Pass]

Let’s start with the device identifier. Ubuntu recommends to use the UUID of the hard drive you want to mount. The UUID can be displayed with the following command:

sudo blkid

The mount point is the folder we created above. The file system type was set when the partition was created before. As we choose defaults. Of course there are a lot of other possibilities which can be found here. The dump section enables or disables backing up the hard drive and is usually set to 0. The last section is responsible for the order fsck checks the device at boot time. It should be set to 2 or to 0 if you want to disable it. Before editing the file make a backup copy.
sudo cp /etc/fstab /etc/fstab.back
Now we can edit the file. Keep in mind that root rights are necessary to edit file. The line that should be added to /etc/fstab looks like this:
UUID=3f8c5321-7181-40b3-a867-9c04a6cd5f2f   /media/MyNewDrive   ext4   defaults   0   2
You can check your work by the following command:
sudo mount /media/MyNewDrive

Reboot and check if everything worked out properly. If you fucked up something like this will appear.
If that hapens, enter the maintenance mode by pressing enter and edit the /etc/fstab file again.
nano /etc/fstab
Alternatively, the previous saved /etc/fstab file can be restored.
mv /etc/fstab.back /etc/fstab
To finish up just reboot the computer.

Leave a Reply

Your email address will not be published. Required fields are marked *

Just another Linux site