Tag Archives: mount dev

How to add 2nd Hard drive to Ubuntu

To add/mount the second hard drive into Ubuntu, open up the terminal window and type:

sudo fdisk -l

Where sdb is our newly added Secondary Harddisk!

To create the partition on the second Hard drive, use the following command and follow the “on screen” instructions:

sudo fdisk /dev/sdb

Use the partprobe command to update the kernel with the changes:

sudo partprobe /dev/sdb

Where /dev/sdb is my device name, you can use your’s!

Now we need to format our newly created partition using the following command:

sudo mkfs /dev/sdb1 -t ext4

Verify the newly created partition:

sudo fdisk -l

Next you need to create a directory for a mount point:

cd /mnt/
sudo mkdir 2ndHDD 
sudo chmod 0777 2ndHDD
ls -l

Next, mount the newly created sdb1 parition into 2ndHDD directory:

sudo mount /dev/sdb1 /mnt/2ndHDD -t ext4

Updated: Run this command once more:

sudo chmod 0777 2ndHDD

Now, we make a test that we can write a file on to the new drive:

touch /mnt/2ndHDD/test.txt
ls /mnt/2ndHDD/* 

Next time, when we will reboot the computer, it will be gone. If we want to mount new hard drive permanently then we need to edit the fstab file:

sudo nano /etc/fstab

Add this line at the end of the fstab file(you can adjust it according to your requirement):

/dev/sdb1 /mnt/2ndHDD ext4 defaults 0 0

Use this command or else reboot your computer:

sudo mount –a

Hope this will help you!

Please Remember me in your prayers!

%d bloggers like this: