Installing A new drive (larger than 2TB) in cPanel Server

Installing or Mounting a new drive to a cpanel server is some thing that is not possible from within WHM interface right now. So if you are not familiar with SSH and it is your first time Do not do it on production server.

The server where i am adding this 3TB SATA drive does have CENTOS 6.5 x86_64 standard with WHM 11.44.0 installed on 120GB SSD.

A good idea to have a full remote back. This is some thing i have learnt hard-way in early years with linux. Here i am assuming that you have the harddrive in place in your server (my data center did it in my case) and you have root access.

df -h

the output is some thing like this at my server

Filesystem Size Used Avail Use% Mounted on
/dev/sda3 102G 12G 85G 13% /
tmpfs 7.8G 0 7.8G 0% /dev/shm
/dev/sda2 504M 59M 420M 13% /boot

This shows only one drive sda (two partitions sda2 and sda3). Now do a fdisk

fdisk -l

The output will likely be some thing like this.

Disk /dev/sdc: 3000.6 GB, 3000592982016 bytes
255 heads, 63 sectors/track, 364801 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 

Disk /dev/sda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 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: 0x000eeac1

Device Boot Start End Blocks Id System
/dev/sda1 1 1045 8388608+ 82 Linux swap / Solaris
/dev/sda2 1045 1110 524288+ 83 Linux
/dev/sda3 1110 14594 108303832+ 83 Linux
Disk /dev/sdb: 3000.6 GB, 3000592982016 bytes
255 heads, 63 sectors/track, 364801 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

For a shorter version with no detail, you can use

fdisk -l | grep '^Disk'

the short outpout

Disk /dev/sdc: 3000.6 GB, 3000592982016 bytes
Disk identifier: 0x00000000
Disk /dev/sda: 120.0 GB, 120034123776 bytes
Disk identifier: 0x000eeac1
Disk /dev/sdb: 3000.6 GB, 3000592982016 bytes
Disk identifier: 0x00000000

As we can see the ssd, sda 120 GB, and two 3000 GB drives sdb and sdc. For this post, i will format sdb. As you noticed in longer version, the sdb and sdc have no partitions. This is how you know which drive is existing and have already partitions on it.

To format and mount a new drive the first step is to create paritions. Again we use fdisk like we always do

oops, here is the output. fdisk refused to partition drives is larger than 2TB and it recommends parted.

Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x42c17c82.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

WARNING: The size of this disk is 3.0 TB (3000592982016 bytes).
DOS partition table format can not be used on drives for volumes
larger than (2199023255040 bytes) for 512-byte sectors. Use parted(1) and GUID
partition table format (GPT).


WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').

lets use parted

parted /dev/sdb

oh no,

-bash: parted: command not found

lets install parted first.

yum -y install parted

If in the end of output you find some thing like this, parted is installed successfully then.

Installed:
parted.x86_64 0:2.1-21.el6

Complete!

Once again run,

parted /dev/sdb

out put

GNU Parted 2.1
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.

on parted prompt, make a new partition table, called GPT dislabel

(parted) mklabel gpt

 

Warning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? yes
(parted)

Next step is to set unit. Enter the unit as GB in following command. If you prefer TB, you may use that.

 (parted) unit GB

to create a 3000 GB partition,

(parted) mkpart primary 0.00GB 3000.00GB

To see how partition is created,

(parted) print

output

(parted) print
Model: ATA ST33000650NS (scsi)
Disk /dev/sdb: 3001GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number Start End Size File system Name Flags
1 0.00GB 3000GB 3000GB primary

Thats all, we are done with parted, now quit

(parted) quit

output

Information: You may need to update /etc/fstab.

Now, use the mkfs.ext4 command to format the partition,

mkfs.ext4 /dev/sdb1

output

mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
183107584 inodes, 732421632 blocks
36621081 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
22352 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000, 214990848, 512000000, 550731776, 644972544

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 28 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

I want to mount this drive as data1,

root@server4 [~]# cd /
root@server4 [/]# mkdir data1
root@server4 [/]# mount /dev/sdb1 /data1

Lets do a df -h and see what have changed since we started the post.

root@server4 [/]# df -lh
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 102G 12G 85G 13% /
tmpfs 7.8G 0 7.8G 0% /dev/shm
/dev/sda2 504M 59M 420M 13% /boot
/dev/sdb1 2.7T 201M 2.6T 1% /data1

This is how it looks in cPanelinstall-new-drive-cpanel