Introduction
This guide explains the process of deleting all of the existing data on a disk, and installing a new filesystem to prepare the disk to be mounted to the server for use as a second home directory.
Please keep in mind that the process of preparing and mounting a disk to the server is a task that is best handled by a systems administrator with the skills, training, and expertise required to do so for you.
Although this issue is not related to cPanel we would like to offer this guide as a courtesy. If this guide is not compatible with your specific server's setup, please consult with a systems administrator for assistance.
Procedure
- Login to the server via SSH or Terminal as the root user
- Locate the disk that you want to use with the lsblk command. The following is an example of what this may look like:
[root@srv01 ~]# lsblk --output NAME,UUID,FSTYPE,SIZE,MOUNTPOINT
NAME UUID FSTYPE SIZE MOUNTPOINT
sda 6934ba51-679e-4b0e-8b7a-368ab8b6ebd7 ext4 49.5G /
sdb a7f334ec-8fd2-44f7-b4b5-46345e459ad7 swap 516M [SWAP]
sdc 13a34224-431e-4582-a0ec-fb2516f14573 ext4 50G - IMPORTANT: Verify that the disk is not mounted and that it does not contain any data that you want to keep. If you are not fully confident that these conditions are met, you must contact a systems administrator with the skills, training, and experience required to verify this for you.
- If needed, partition the disk with a utility such as fdisk. You do not need to partition the disk if you want to use the entire disk. You would only need to partition the disk if you want to create multiple partitions on it.
- Create a filesystem on the disk or partition. In this example, we are formatting the entire disk as ext4, rather than using partitions. The ext4 filesystem shown in this example is a good general choice for most applications including disks to hold cPanel account data:
[root@srv01 ~]# mkfs.ext4 "/dev/sdc"
mke2fs 1.42.9 (28-Dec-2013)
/dev/sdc is entire device, not just one partition!
Proceed anyway? (y,n) y
Discarding device blocks: done
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
3276800 inodes, 13107200 blocks
655360 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2162163712
400 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
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done - Update the /etc/fstab file so that your server will mount the disk to the correct location when the server is booted.
IMPORTANT: If there is a mistake in the /etc/fstab configuration your server may not be able to boot. DO NOT copy the configuration from this example. Your server will fail to boot if you copy this example exactly. If you are not able to modify the configuration to match your specific application, you must contact a systems administrator that has the skills, training, and experience required to properly configure the /etc/fstab configuration file for you.
In the following example I have configured the my disk to mount to the /home2 directory for use as a second storage location for cPanel accounts:
[root@srv01 ~]# cat /etc/fstab
For more information on the fstab file, you can open the documentation with 'man fstab'
# ...
/dev/sda / ext4 usrjquota=quota.user,jqfmt=vfsv0 1 1
/dev/sdb none swap defaults 0 0
/dev/sdc /home2 ext4 usrjquota=quota.user,jqfmt=vfsv0 1 1
/usr/tmpDSK /tmp ext3 defaults,noauto 0 0 - Make sure that the directory that you have specified in the /etc/fstab file exists on the server. In this case, I will create the /home2 directory:
[root@srv01 ~]# mkdir /home2
- Then mount all of the disks in the /etc/fstab configuration with the following command:
mount -a
- Use the lsblk command to verify that the disk has been mounted in the location that you desire:
[root@srv01 ~]# lsblk --output NAME,UUID,FSTYPE,SIZE,MOUNTPOINT
NAME UUID FSTYPE SIZE MOUNTPOINT
sda 6934ba51-679e-4b0e-8b7a-368ab8b6ebd7 ext4 49.5G /
sdb a7f334ec-8fd2-44f7-b4b5-46345e459ad7 swap 516M [SWAP]
sdc cd0876be-6b43-417e-9fbf-b02d05960bd8 ext4 50G /home2 - You may now configure this new disk to be used for cPanel accounts with the details in the following article:
How to use an additional disk with cPanel