If you have a dedicated server with 2 hard drives, there might come a time when your primary hard drive is starting to become full, and you’d like to utilize your secondary hard drive.
You can either simply create an FTP account with access to your secondary hard drive to start uploading files there for storage, or you can go all out and rearrange your cPanel account to actually use the secondary hard drive for all of their files.
- Find Disk Usage on Server
- Rearrange cPanel Account onto Secondary Drive
- Create a Separate FTP Account on Secondary Hard Drive
Please note that to follow either of these options you need to have root access to your dedicated server.
Using a Secondary Drive allows you to have more options and features that you can make use of for your account. They include:
- Additional data redundancy, and storage space
- Ability to separate data and application files
- Make use of FTP for file management
- Make use of cPanel Configuration options
Find Disk Usage on Server
Prior to setting up anything on your secondary hard drive, you should understand the current disk usage on your server which is very simple to review following these steps.
- Login via SSH as the root user on your server.
- Run the following command:
You should get an output similar to this:
Filesystem Size Used Avail Use% Mounted on
/dev/sdb1 222G 186G 25G 89% /
/dev/sda1 226G 228M 214G 1% /home2
tmpfs 2.0G 0 2.0G 0% /dev/shm
/usr/tmpDSK 485M 12M 448M 3% /tmp
I have bolded and italicized the secondary drive on this server indicated by /home2. You can see we’re using up about 89% of the available disk space on our primary hard drive, with 25GB to spare.
Let’s say you know you need to upload 30GB worth of files to store on your server, since you still have 214GB free on the secondary hard drive you could use that instead of filling your primary hard drive past capacity.
Rearrange cPanel Account onto Secondary Drive
If you’re running out of hard drive space on your primary drive, and still need to upload website files directly to your cPanel account, you can rearrange the cPanel account to have its home directory on your secondary drive.
You could also just create a separate FTP account on the secondary hard drive if you just needed some more file storage separate from your primary hard drive.
- Login to WHM on your dedicated server.
- In the top-left search box, type rearrange. Then click on Rearrange an Account.
- Select a cPanel account you want to move to your secondary drive, and then click on Rearrange
- You can see the Current Home Directory is set to /home/example Select /home2 from the New mount point for this account drop-down and click Move Account.
DO NOT close WHM or try to interrupt the move process until it fully completes. Depending on the size of your cPanel account this could take some time. You should see a success message once the move is complete:
- Now whenever you upload files for this cPanel account, it will be uploaded to your secondary drive instead of continuing to fill up the primary one. You can verify this on the server by running:
The server should spit back:
/home/example: symbolic link to `/home2/example’
This shows that nothing will be uploaded to the primary hard drive on /home for this example cPanel user, as their home directory on the primary drive is simply a symbolic link to their home directory on the secondary drive.
Create a Separate FTP Account on Secondary Hard Drive
If you just need to store some files on your servers such as database backups, or something you aren’t going to directly use on your website right away. You can simply create a 2nd FTP account on your secondary hard drive to upload these types of files there.
These files would only be accessible over FTP. You wouldn’t be able to access them from cPanel, or via your website. If you need that you can rearrange a cPanel account onto the secondary drive instead.
- Login to the cPanel account where you wish to create an FTP account for your secondary drive.
- Under the Files section, click on FTP Accounts.
- Fill in the details for a new FTP user, in this case, you can see I’m naming mine [email protected] and assigning the user’s directory to be /home/example/public_html/2ndDrive
- Login to your server with the root user via SSH.
- In this example, we created our secondary FTP account on our example cPanel account. The actual settings for this FTP user are stored then in the example user’s proftpd file which you can view with:
This will spit back all the current FTP account settings for this example cPanel user:
2nddrive:$1$9Xp:502:501:example:/home/example/public_html/2ndDrive:/bin/ftpsh example:$1$nsk:502:501::/home/example:/bin/bash ftp::14:50::/home/example/public_ftp:/bin/ftpsh example_logs:$1$nsk:502:501:example:/usr/local/apache/domlogs/example:/bin/ftpsh
I’ve trimmed the long password hashes so the text can fit above, but you should see I’ve bolded the 2ndDrive FTP user we created, and it belongs to the example cPanel user and the home directory is set to /home/example/public_html/2ndDrive
- Now edit the /etc/proftpd/example file using this command:
Now use your arrow keys to navigate in the vi text-editor to the /home/ line of our new FTP user.
Hit “i” on your keyboard to enter INSERT mode, and edit this line to read
Then hit ESC to exit INSERT mode, and then Shift ZZ to save the file
- Next, you’ll want to create the directory on the secondary hard drive for this FTP user with:
mkdir -p /home2/example/2ndDrive
You also want to sure the example cPanel username has ownership of this directory with:
chown example.example /home2/example/2ndDrive -R
- Now if you connect with this [email protected] FTP user in your FTP client, you’ll be presented with a blank directory, and you can start uploading files there. After your files are uploaded you can take a look back on the server to verify they ended up on your secondary drive:
You should see the file you just uploaded:
drwxr-xr-x 2 example example 4096 Nov 14 14:38 ./
drwxr-xr-x 3 root root 4096 Nov 14 14:33 ../
-rw-r–r– 1 example example 40677376 Nov 14 14:39 brackets-sprint-33-WIN.msi
You should now understand how to find out how much disk space is being used on all of the hard drives on your server. Also, you know how to either create a secondary FTP account to utilize the secondary hard drive or rearrange the entire cPanel account to make the secondary hard drive the user’s new home going forward.