Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Harddrive Swap

Discussion in 'General Discussion' started by crag364, Apr 29, 2012.

  1. crag364

    crag364 Registered

    Dec 19, 2007
    Likes Received:
    Trophy Points:

    I have had to upgrade the size of my harddrive on my server due to it getting full and now require to move all the data over. What I have done so far is had a new drive installed as the primary and made my old drive secondary. I have then had the OS installed on the new drive. Now I just need to move the cpanel files over from the old drive to the new.

    I found a post buried deep in the archives in how to do this and I was just wondering if it is still applicable now. I had some trouble mounting the harddrive as old. So instead I have mounted each mount point seperatly.

    cPanel Restore Guide - Updated version of Pimpenstein's Original Guide
    So your cpanel server got hacked or crashed? Lots of that going around these days. And if you didn't have cpanel backups of all your sites, then your only option is to copy from the old drive... heres the basics..
    commands to be executed from root shell preceded by #
    1) Order restore from The Planet. In trouble ticket specify to leave the old drive in
    2) Once the restore is done, SSH in to box..
    mount the old / partition as old (on TP boxes almost always /dev/hda3)
    root@box# mount /dev/hda /old
    run chkrootkit to make sure you don't copy back infected files...
    now we can start copying back data from the old drive
    root@box# rsync -vrplogDtH /old/usr/local/apache/conf /usr/local/apache
    root@box# rsync -vrplogDtH /old/var/named /var
    root@box# rsync -vrplogDtH /old/home/* /home
    root@box# rsync -vrplogDtH /old/usr/local/cpanel /usr/local
    root@box# rsync -vrplogDtH /old/var/lib/mysql /var/lib
    root@box# rsync -vrplogDtH /old/var/cpanel /var
    root@box# rsync -vrplogDtH /old/usr/share/ssl /usr/share
    root@box# rsync -vrplogDtH /old/var/ssl /var
    root@box# rsync -vrplogDtH /old/usr/local/cpanel/3rdparty/mailman /usr/local/cpanel/3rdparty
    root@box# rsync -vrplogDtH /old/var/log/bandwidth /var/log
    root@box# rsync -vrplogDtH /old/usr/local/frontpage /usr/local
    root@box# rsync -vrplogDtH /old/var/spool/cron /var/spool
    root@box# rsync -vrplogDtH /old/root/.my.cnf /root
    root@box# rsync -vrplogDtH /old/etc/httpd/conf/httpd.conf /etc/httpd/conf
    root@box# rsync -vrplogDtH /old/etc/sysconfig/network /etc/sysconfig
    then change to the old etc, and execute all on one line ...
    root@box# cd /old/etc
    root@box# rsync -vrplogDtH secondarymx domainalias valiases vfilters exim* proftpd* pure-ftpd* passwd* group* *domain* *named* wwwacct.conf cpupdate.conf quota.conf shadow* *rndc* ips* ipaddrpool* ssl hosts /etc
    well I hope I got everything... after you move all that stuff you will find yourself fixing up little things here and there....
    I recomend updating cpanel afterwards:
    /scripts/upcp --force
    Source: Restoring Cpanel from old drive after crash or hack - The Planet Forums

    Is this the best way in doing things? I am unable to make a backup due to it just being to large until I get this drive removed and put a larger backup drive back in.


  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Apr 11, 2011
    Likes Received:
    Trophy Points:
    cPanel Access Level:
    Root Administrator
    Hello :)

    The method you have pasted may or may not work. The only supported method would have been to backup the accounts (locally or to a remote server) before reinstalling the operating system. While you are welcome to attempt to restore the accounts using the method you pasted, we can't guarantee it will be useful. Let us know if you experience any errors or have questions after using this method.

    Thank you.

Share This Page