Adding a additional hard disk to your workstation or server is easy and often required. Here’s we’ll step through the process of identifing the newly attached drive, prepare and mount it.
If you have just added a virtual disk to a virtual machine, make sure you restart the virtual machine before mounting the new disk.
1. Figure out the device name for the new device
This will give you output similar to this:
Disk /dev/sda: 21.4 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sda1 * 1 2517 20217771 83 Linux /dev/sda2 2518 2610 747022+ 5 Extended /dev/sda5 2518 2610 746991 82 Linux swap / Solaris Disk /dev/sdb: 32.2 GB, 32212254720 bytes 255 heads, 63 sectors/track, 3916 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk /dev/sdb doesn't contain a valid partition table
2. Next we’ll partion the new disk using the following command:
cfdisk /dev/sdb > New -> Primary -> Specify size in MB > Write > Quit
3. Format the new disk using the ext3 filessystem
4. Mounting the drive to a new folder
mkdir /disk2 mount -t ext3 /dev/sdb1 /disk2
You can name the folder whatever your want and place it in a subfolder of another mounting point, for example /var/disk2
5. Add the new drive to fstab so that it will automatically mount when we reboot the machine. Add the following line to your fstab file (pico /etc/fstab)
/dev/sdb1 /disk2 ext3 defaults,errors=remount-ro 0 1
Now your new hard disk is mounted and ready to use.