The time may come when you need to add additional storage to your Linux dedicated server. This might be to install a solid state drive, create new databases, back up data, expand your websites or even to add new virtual machines. Regardless of the reason, you would essentially use the same method to make Linux recognize your new disk.
To begin, you need to understand how drives are named. The format basically mirrors the order your drives are connected to the system:
/dev/hda – 1st primary drive
/dev/hdb – 2nd primary drive
…and so on
The first thing you need to do is partition the drive. As root, you need to type fdisk [drive name]. For example, if the drive is /dev/hdb, type:
# fdisk /dev/hdb
From the menu that appears, type, “n” to create a new partition. Then, selected either “e” or “p” for extended or primary partition. Then, enter the number of the partition. Next, press “p” to print the partition table and make sure it looks the way you want. Finally, press “w” to write the changes. WARNING: Once you press “w”, you will destroy whatever was previously occupying that space on the drive.
Finally, you need to format the drive and add it to /etc/fstab if you want it to mount automatically.
# mkfs -t ext4 /dev/hdb1
Replace “ext4” with whatever file system type you prefer.
You will then need to create a mount point. For example:
# mkdir /newdrive
# mount -t ext4 /dev/hdb1 /newdrive
You can add it to fstab by editing /etc/fstab and then entering a line like this:
/dev/hdb1 /newdrive ext4 defaults 1 2