Mount Another Hard Disk in Linux

Today we are going to mount another hard drive in our server. Currently we have primary hard drive (hda) on which operating system is installed. We need another hard disk to maintain backups or any other data. Mounting hard disk is easy task if we know the exact steps. I am going to demonstrate how to mount another hard disk, other than hda(Master IDE), on server:

1. You need root privileges for mounting hard disk to server. Login using root credentials, if you already logged in, switch to root using ‘su –‘ command.

2. Next step is to verify the hard disk need to installed/mount on server. You can check this using fdisk on server shell.

fdisk –l

You will get output similar to this:

Disk /dev/hda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytesDevice Boot Start End Blocks Id System
/dev/hda1 * 1 9354 75135973 83 Linux
/dev/hda2 9355 9729 3012187 5 Extended
/dev/hda5 9355 9729 3012156 82 Linux swap / SolarisDisk /dev/hdc: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Here you can see 80GB hard drive (hdc) listed in output.

3. Once you identified second hard disk next step is to initialized and partitioned it using the following commands:

[root]# fdisk /dev/hdc
Command (m for help): n
Command action
e extended
p primary partition (1-4)
e
Partition number (1-4): 1
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-2654, default 2654):
Using default value 2654Command (m for help): pDisk /dev/hdc: 240 heads, 63 sectors, 2654 cylinders
Units = cylinders of 15120 * 512 bytesDevice Boot Start End Blocks Id System
/dev/hdc1 1 2654 20064208+ 5 ExtendedCommand (m for help): w (Write and save partition table)

Now your new hard disk with a partition is ready. Next step is to format this newly created disk/partition to use it.

4. Format the disk using with your favorite file system. I am using ext3 file-system for my tutorial.

mkfs.ext3 /dev/hdc1

This will format your drive with ext3 file system.

5. Now create the mount point where you want to mount your hard disk. Without mounting you can’t use it.

# mkdir /mnt
# mount -t ext3 /dev/hdc1 /mnt

6. Do not forget to make entry in fstab so that it will be automatically mounted after rebooted. Open fstab file in your favorite editor perform the following steps to permanent mount your newly created hard disk. I am using vi editor:

vi /etc/fstab

Add the following line at the end of the file:

/dev/hdc1 /mnt ext3 defaults 0 0

If you are not comfortable with editors, you can also make the above entry from shell directly using the following command:

echo “/dev/hdc1 /mnt/drive2 ext3 defaults 0 0″ >> /etc/fstab

Now save and quit from the file. You are all done with modification to add new hard disk.
Please do comments and give your feedback. :)

One Response to Mount Another Hard Disk in Linux

  1. Source says:

    Hey there! Do you use Twitter? I’d like to follow you if that would be ok. I’m definitely enjoying your blog and look forward to new posts.

Leave a Reply

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

*


4 − two =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Optimized by SEO Ultimate