Using a Secondary Hard Drive on a Dedicated Server
If you have a dedicated server with 2 hard drives, there might come a time where 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
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 output similiar 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 highlighted in red 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
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
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 Separate FTP Account on Secondary Hard Drive
If you just need to store some files on your server 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 type 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 cPanel for the account you wish to create an FTP account on your secondary drive for.
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 2ndDrive@example.com and assigning the user's directory to be /home/example/public_html/2ndDrive
Then click on Create FTP Account
Now 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 highlighted in red 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 till the /home/ line of our new FTP user.
Hit i on your keyboard to enter INSERT mode, and edit this line to read /home2/example/2ndDrive
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 2ndDrive@example.com FTP user in your FTP client, you'll be presented a blank directory, and you can start uploading files there.
After your files are upload you can take a look back on the server to verify it ended up on your secondary drive:
You should see the file you just uploaded:
total 39776 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 how to either create a secondary FTP account to utlize the secondary hard drive, or rearranging the entire cPanel account to make the secondary hard drive the user's new home going forward.
We value your feedback!
There is a step or detail missing from the instructions.
The information is incorrect or out-of-date.
It does not resolve the question/problem I have.
Post a Comment
Do you want to publish a tutorial to our support center?