Are you working on Linux server? And want to add more space on server then you can add an additional hard drive on server to increase disk space on server. After adding new drive you have to configure it on server to create another /home directory on server. It is must to install hard drive physically on server. It is very easy to configure home directory partition on server, let’s see how....
1. First you have to partitioning the disk according to our need. Before starting the partition you have to remember that this is the second disk on your server and you have to named it according to drive like /dev/sdb or /dev/hdb.
Use command “fdisk -l” to list all the active disks on server. Already configured disk will be show like this:
Now we are going to create a single partition that will be /home2 on server. To create a partitions use this command:
To check free space use this is command: print free and you can get following output :
We are going to create one partition and let’s see how it will work :
For multiple partitions you have to use device name as /dev/sdb1, /dev/sdb2 and /dev/sdb3. Now type quit command and close the session.
2. Formatting the disk : In this step we are going to format the disk by using the below command :
For example:
NOTE: You can also set the percentage for the disk by using this command pass -m <%> to the mkfs.ext[2|3] command.
3. Labelling and mounting the disk :
We need to label the disk /home2 and for that we have to use this command :
You can also check the for the disk labelled by using this command :
And output will be :
Now the folder will be created with named /home2 and added the following to /etc/fstab :
You have to repeat the step for each partition created for the disk. At last you have to mount new partition easily with this command:
4. Setup cPanel by editing in /etc/wwwacct.conf file :
After labelling and mounting the disk now we have to setup the disk by making changes in /etc/wwwacct.conf file. By default user created in /home directory also known as HOMEDIR. If you need to add another home directory then you have to edit HOMEDIR. Let’s know more about both HOMEDIR and HOMEMATCH.
HOMEDIR: In this directory all the new users will be created. It’s by default home directory for all the users (/home).
HOMEMATCH: This is the additional home directory for the new users.
If you need to specify a particular folder where all the new users will be created then you have to enter partition/ folder. This can be happen by leaving blank HOMEMATCH and make changes in HOMEDIR. But if you need to pick most free-able disk for the user then you have to specify value for HOMEMATCH.
From the above command the new accounts will be created on either /home or /home2 which is totally depend on free space.
1. First you have to partitioning the disk according to our need. Before starting the partition you have to remember that this is the second disk on your server and you have to named it according to drive like /dev/sdb or /dev/hdb.
Use command “fdisk -l” to list all the active disks on server. Already configured disk will be show like this:
Code:
Disk /dev/sdb : 500.0 GB, 500000000000 bytes
413 heads, 89 sectors/track, 50765 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Code:
Parted /dev/sdb
Code:
Number Start End Size Type File system Flags
0.00kB 250GB 250GB Free Space
Code:
(parted) mkpart
Partition type? primary/extended? primary
File system type? [ext2]? ext3
Start? 0kB
End? 250GB
2. Formatting the disk : In this step we are going to format the disk by using the below command :
Code:
/dev/<device><partition>
Code:
For ext2: mkfs.ext2 /dev/sdb1
For ext3: mkfs.ext3 /dev/sdb1
For ext4: mkfs.ext4 /dev/sdb1
3. Labelling and mounting the disk :
We need to label the disk /home2 and for that we have to use this command :
Code:
e2label /dev/sdb1 /home2
Code:
e2label /dev/sdb1
Code:
root@server [~]# e2label /dev/sdb1
/home2
Code:
LABEL=/home2 /home2 ext4 defaults,usrquota,noatime 0 0
Code:
Mount /home2
After labelling and mounting the disk now we have to setup the disk by making changes in /etc/wwwacct.conf file. By default user created in /home directory also known as HOMEDIR. If you need to add another home directory then you have to edit HOMEDIR. Let’s know more about both HOMEDIR and HOMEMATCH.
HOMEDIR: In this directory all the new users will be created. It’s by default home directory for all the users (/home).
HOMEMATCH: This is the additional home directory for the new users.
If you need to specify a particular folder where all the new users will be created then you have to enter partition/ folder. This can be happen by leaving blank HOMEMATCH and make changes in HOMEDIR. But if you need to pick most free-able disk for the user then you have to specify value for HOMEMATCH.
Code:
Edit /etc/wwwacct.conf and set HOMEDIR as /home2.
OR
Edit /etc/wwwacct.conf and set HOMEMATCH as /home*.