Mounting a new hard drive in linux

 

 

Hello,

 

In this post I will walk through adding a new hard disk drive in Linux. I added a new 20GB harddisk to the hardware. Then boot the machine. Now you will see the disk in the fdisk -l command as shown below, /dev/sdb.

 

1

 

2. Now let’s create a new partition for mounting it using fdisk command fdisk /dev/sdb.

2

 

3. You may use option m to know the list of options as shown below.

3

 

4. Now, use option n to add a new partition. Then, enter p for primary partition and e for extended partition, and enter the partition number here I am entering as 3( it can be anything between 1-4 because it is not my primary hard disk, enter the start and end size of the cylinder. Here I have used all the cylinder volume as shown in the screenshot below.

4

 

5. Now, enter command p to print the partition tables, and then w to write the partition table information to disk and exit as shown below.

5

 

7. Now, format the disk with the required filesystem type. Here I have used ext3 file system to format the disk, as shown below.

7

 

8. Let’s create a new folder using mkdir command, I created /disk1 folder and mounted the harddisk with mount /dev/sdb3 /disk1 command, now you can see the mounted disk which consists of 20GB size as shown below.

8

 

9. You edit the fstab entry to mount the disk permanently on boot. Please find the screenshot highlighted below, please use mount -a command just to verify if you have entered fstab values correctly, as shown below.

9

 



That’s it. You are done 🙂 Thank you for viewing helpinlinux.com

 

This entry was posted in linux.

Leave a Reply

Protected by WP Anti Spam