Using a Secondary Hard Drive on a Dedicated Server

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.

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.

  1. Login via SSH as the root user on your server.
  2. Run the following command:

    df -h

    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.

  1. Login to WHM on your dedicated server.
  2. In the top-left search box, type rearrange. Then click on Rearrange an Account.

    whm click on rearrange an account
  3. Select a cPanel account you want to move to your secondary drive, and then click on Rearrange

    whm select account and click rearrange
  4. 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:

    Re-arrange account
  5. 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:

    file /home/example

    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.

  1. Login to the cPanel account where you wish to create an FTP account for your secondary drive.
  2. Under the Files section, click on FTP Accounts.

    click on ftp accounts
  3. 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

    create 2nd drive ftp user


  4. Login to your server with the root user via SSH.
  5. 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:

    cat /etc/proftpd/example

    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

  6. Now edit the /etc/proftpd/example file using this command:

    vi /etc/proftpd/example

    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

    /home2/example/2ndDrive

    Then hit ESC to exit INSERT mode, and then Shift ZZ to save the file

    Edit etc proftpd ftp path

  7. 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
  8. 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:

    ll
    /home2/example/2ndDrive


    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, 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.

Scale your business with high-performance dedicated hosting. Choose from Managed Dedicated Servers powered by cPanel, or select a Bare Metal Server for complete server control via the command line.

DDoS Protection    99.99% Uptime    Software RAID    New Customer Discounts

Explore Dedicated Hosting

AC
Arnel Custodio Content Writer I

As a writer for InMotion Hosting, Arnel has always aimed to share helpful information and provide knowledge that will help solve problems and aid in achieving goals. He's also been active with WordPress local community groups and events since 2004.

More Articles by Arnel

3 Comments

  • df -h show only one disk can you disk partition system is

    1000GB 
    / 4000
    /boot 250M
    /usr 16000M
    /var 16000M
    /tmp 1024M
    swap (16000M)
    /home fill to disk 

    1000GB 
    / 4000 
    swap (16000M)
    /home2 fill to disk

    when centos installation complete it show 

     

    [[email protected] home]# df -h
    Filesystem Size Used Avail Use% Mounted on
    /dev/sdb1 39G 701M 36G 2% /
    tmpfs 16G 0 16G 0% /dev/shm
    /dev/sdb3 863G 72M 820G 1% /home2
    [[email protected] home]#

    why not showing second disk

Was this article helpful? Let us know!