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.
You will get output similar to this:
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:
Command (m for help): n
p primary partition (1-4)
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.
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.
# 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:
Add the following line at the end of the file:
If you are not comfortable with editors, you can also make the above entry from shell directly using the following command:
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.