How to add new hard disk to ClearOS 6.4 Server

I just installed the new version of ClearOS 6.4 server on my Virtualbox. I do love ClearOS as my favorite server appliance for my office and home network. On this tutorial, I am going to show you how to add new hard disk and format it on ClearOS 6.4 server. This hard disk will be used to store data on the server.

Steps to add new hard disk to ClearOS Server

1. Connect the hard disk to the computer/server and boot up ClearOS

2. Now login to ClearOS server via ssh or putty (Windows).

3. Type fdisk -l to see the hard disk connected to your server

 

[root@server ~]# fdisk -l

Disk /dev/sda: 16.1 GB, 16106127360 bytes
255 heads, 63 sectors/track, 1958 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000e21d6

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              64        1959    15215616   8e  Linux LVM

Disk /dev/sdb: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

 

On the example above, the 2nd hard disk is recognized as /dev/sdb

3. Create partition and format the disk

fdik /dev/sdb

Press "n" to create new partition

press "p" to create primary partition

Press '1" to create 1 primary partition and

Press "w" to write change to the disk

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p1
Partition number (1-4): 1
First cylinder (1-1044, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-1044, default 1044):
Using default value 1044

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

Now you have 1 primary partition on your new disk. Now we need to format and mount it

fdisk -l

Now you should see your new partition listed

Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        1044     8385898+  83  Linux

Format the /dev/sdb1

mkfs.ext3 /dev/sdb1

The command above will format the partition using ext3 file format.

Mount the partition

mkdir /mnt/disk2

mount /dev/sdb1 /mnt/disk2

The command will mount the disk into new directory /mnt/disk2