Skip to main content

Recover server from Disk Image

Comments

6 comments

  • Jcats
    Ouch, none of it should really be a problem other than the databases. I would most likely create all the accounts via WHM then use rsync to sync up the home directories, this will take care of the web site files, emails, forwarders, etc. The DNS entries shouldn't be an issue either, would just rsync them as well. As long as you create the accounts using the same usernames, you can do something like this Syncing homedirs
    for i in `ls -I . -I .. /var/cpanel/users` ; do echo Syncing account $i now ; rsync -ahvz /olddrive/home/$i/ /home/$i/ ; done
    DNS zones
    rsync -ahvz /olddrive/var/named/*.db /var/named/ ; service named reload
    I'm not to sure if that will cause issues with serials but maybe someone else can comment on that. You will want to make sure all ownership / permissions are in order after syncing the homedirs:
    for i in `ls -I . -I .. /var/cpanel/users` ; do chown -R $i: /home/$i/public_html ; chown $i:nobody /home/$i/public_html ; find /home/$i/public_html/ -type f -exec chmod 644 {} \; ; find /home/$i/public_html/ -type d -exec chmod 755 {} \; ; done
    The databases, I'd probably throw up a VPS running the same version as your previous MySQL server, and just drop your /olddrive/var/lib/mysql/ into that vm's mysql data directory, restart and hope they work, then you can mysqldump from there. You would need to do the mysql database itself as well otherwise you would have to manually add back all the users / permissions. Hopefully this gets you started at least.
    0
  • damtech
    Thats great thanks! When im copying the home dir, its doing a file: useraccoutname/.spamassassin/bayes_toks.broken.1437960356 Trouble is this file must be massive, and it seems to be trying to expand it when syncing, so it fills the hard drive, stopes because the disk is full, then releases all the space again. Is there a way to exclude this file/folder?
    0
  • damtech
    It's OK. I got past it. Just removed the file and it continued no problem
    0
  • cPanelMichael
    I got past it. Just removed the file and it continued no problem

    Hello :) I'm happy to see the transfer was able to proceed. Could you confirm if the server files have now been successfully restored? Thank you.
    0
  • damtech
    I did yes. I followed the commands here:
    0
  • cPanelMichael
    I'm happy to see the issue is now resolved. Note that it's a good idea to keep backups of your accounts as generated through the cPanel backup options to avoid this problem in the future. Thank you.
    0

Please sign in to leave a comment.