Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
cpanel:restore-from-crash-or-hack [2011-04-14 19:37:12]
garrett.plasky Approved
cpanel:restore-from-crash-or-hack [2011-09-16 04:11:21]
garrett.plasky Approved
Line 10: Line 10:
 Restoring the data is just a matter of rsync-ing over certain directories and configuration files.  Restoring the data is just a matter of rsync-ing over certain directories and configuration files. 
  
-<note important>rsync functions different than users might expect with regards to trailing slashes; careful use of them is needed to ensure data is copied correctly. When syncing a directory, adding a trailing slash to the source directory will cause all directories/files //inside// that directory to be synced with the destination, as opposed to the directory itself. This can be seen for example in the difference between the /etc/ sync below, and the Apache rsync that follows.</note>+<note important>**rsync** functions different than users might expect with regards to trailing slashes; careful use of them is needed to ensure data is copied correctly. When syncing a directory, adding a trailing slash to the source directory will cause all directories/files //inside// that directory to be synced with the destination, as opposed to the directory itself. This can be seen for example in the difference between the /etc/ sync below, and the Apache rsync that follows.</note>
  
 Let's begin by syncing over important /etc/ configuration files: Let's begin by syncing over important /etc/ configuration files:
  
-<code console>cd /olddrive/etc/ && rsync -avHz user* trueuser* domainips secondarymx domainalias valiases \+<sxh plain>cd /olddrive/etc/ && rsync -avHz user* trueuser* domainips secondarymx domainalias valiases \
 vfilters exim* backupmxhosts proftpd* pure-ftpd* logrotate.conf passwd* group* *domain* *named* wwwacct.conf \ vfilters exim* backupmxhosts proftpd* pure-ftpd* logrotate.conf passwd* group* *domain* *named* wwwacct.conf \
-cpbackup.conf cpupdate.conf quota.conf shadow* *rndc* ips* ipaddrpool* ssl hosts /etc</code+cpbackup.conf cpupdate.conf quota.conf shadow* *rndc* ips* ipaddrpool* ssl hosts spammer* \ 
-**Note**: You may also want to copy /etc/crontab and /etc/cron.d/ if you have custom cron scripts.+skipsmtpcheckhosts relay* localdomains remotedomains my.cnf /etc</sxh
 +<note tip>You may also want to copy <c>/etc/crontab</c> and <c>/etc/cron.d/</c> if you have custom cron scripts.</note>
  
-Next up is Apache and it'configuration:+Next up is Apache and its configuration:
  
-<code console>rsync -avHz /olddrive/usr/local/apache/conf /usr/local/apache +<sxh plain>rsync -avHz /olddrive/usr/local/apache/conf /usr/local/apache 
-rsync -avHz /olddrive/usr/local/apache/modules /usr/local/apache +rsync -avHz /olddrive/usr/local/apache/modules /usr/local/apache 
-rsync -avHz /olddrive/usr/local/apache/domlogs /usr/local/apache</code>+rsync -avHz /olddrive/usr/local/apache/domlogs /usr/local/apache</sxh>
  
 Next is named (bind). This is only needed if you run your own DNS: Next is named (bind). This is only needed if you run your own DNS:
  
-<code console>rsync -avHz /olddrive/var/named /var</code>+<sxh plain>rsync -avHz /olddrive/var/named /var</sxh>
  
 Next we'll do cPanel and it's related configurations: Next we'll do cPanel and it's related configurations:
  
-<code console>rsync -avHz /olddrive/usr/local/cpanel /usr/local</code>+<sxh plain>rsync -avHz /olddrive/usr/local/cpanel /usr/local</sxh>
  
 Next up, MySQL databases: Next up, MySQL databases:
  
-<code console>rsync -avHz /olddrive/var/lib/mysql /var/lib</code>+<sxh plain>rsync -avHz /olddrive/var/lib/mysql /var/lib</sxh>
  
 Misc cPanel files and templates: Misc cPanel files and templates:
  
-<code console>rsync -avHz /olddrive/var/cpanel /var</code>+<sxh plain>rsync -avHz /olddrive/var/cpanel /var</sxh>
  
 Client and server SSL certificates: Client and server SSL certificates:
  
-<code console>rsync -avHz /olddrive/usr/share/ssl /usr/share</code>+<sxh plain>rsync -avHz /olddrive/usr/share/ssl /usr/share</sxh>
  
 User bandwidth data: User bandwidth data:
  
-<code console>rsync -avHz /olddrive/var/log/bandwidth /var/log</code>+<sxh plain>rsync -avHz /olddrive/var/log/bandwidth /var/log</sxh>
  
 Exim's mail queue: Exim's mail queue:
  
-<code console>rsync -avHz /olddrive/var/spool/cron /var/spool</code> +<sxh plain>rsync -avHz /olddrive/var/spool/cron /var/spool</sxh>
- +
-Root user MySQL configuration (stores root password for password-less shell connects): +
- +
-<code console># rsync -avHz /olddrive/root/.my.cnf /root</code>+
  
 +Root user MySQL configuration:
  
 +<sxh plain>rsync -avHz /olddrive/root/.my.cnf /root</sxh>
  
 Finally, all user data (mail, web files, etc.): Finally, all user data (mail, web files, etc.):
  
-<code console>rsync -avHz /olddrive/home/* /home</code>+<sxh plain>rsync -avHz --exclude=virtfs/ /olddrive/home/* /home</sxh>
  
  
Line 67: Line 66:
 Because we've changed some cPanel files around and imported a bunch of user data, we'll want to make sure that these changes are picked up: Because we've changed some cPanel files around and imported a bunch of user data, we'll want to make sure that these changes are picked up:
  
-<code console>/scripts/upcp --force +<sxh plain>/scripts/upcp --force 
-/scripts/easyapache +/scripts/easyapache 
-/scripts/initquotas +/scripts/initquotas 
-/scripts/eximup --force +/scripts/eximup --force 
-/scripts/mysqlup --force +/scripts/mysqlup --force 
-/etc/init.d/cpanel restart +/etc/init.d/cpanel restart 
-/scripts/restartsrv_apache +/scripts/restartsrv_apache 
-/scripts/restartsrv_exim +/scripts/restartsrv_exim 
-/scripts/restartsrv_named</code>+/scripts/restartsrv_named</sxh>
  
 Since we copied over the contents of <c>/var/cpanel</c>, your previously saved Apache/PHP build options will be retained when <c>/scripts/easyapache</c> is run above (select //Previously Saved Config//). Since we copied over the contents of <c>/var/cpanel</c>, your previously saved Apache/PHP build options will be retained when <c>/scripts/easyapache</c> is run above (select //Previously Saved Config//).
Line 84: Line 83:
  
 ===== Notes ===== ===== Notes =====
-  * This was last tested to work as of cPanel/WHM 11.24. Newer versions might change the functionality of scripts and/or add additional configuration files.+  * This was last tested to work as of cPanel/WHM 11.26. Newer versions might change the functionality of scripts and/or add additional configuration files.
  
 {{tag>restore how-to cpanel vps}} {{tag>restore how-to cpanel vps}}