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.

Restore all Accounts from NAS

Discussion in 'General Discussion' started by CoolMike, Aug 4, 2004.

  1. CoolMike

    CoolMike Well-Known Member

    Joined:
    Sep 6, 2001
    Messages:
    307
    Likes Received:
    0
    Trophy Points:
    16
    Hi

    I'm working right now on my backup and restore prcedure. I have a server with 2 Harddisks with Raid1. On this disk I have a backup partition, where I do a daily backup. Once a week I copy all the files from daily backup directory to a NAS.

    In case of an emergency, I would just reinstall Redhat and WHM, but how can I restore all the customer accounts at once?

    I know, that I can copy the *.tar.gz files from the backup to the home directory and use the "Restore a Full Backup/cpmove file" function. But then I have to do this with each single account. Is there no possibilty to restore all the accounts at once?

    Thanks
    Michael
     
  2. CoolMike

    CoolMike Well-Known Member

    Joined:
    Sep 6, 2001
    Messages:
    307
    Likes Received:
    0
    Trophy Points:
    16
    Hmm, does this mean nobody know how to do it? Or nobody want to share this very important information?


    Michael
     
  3. joelmonteiro

    joelmonteiro Member

    Joined:
    Oct 14, 2003
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Porto - Portugal
    I would like to solve this problem too... but I don't know how to... :mad:
     
  4. compunet2

    compunet2 Well-Known Member

    Joined:
    Feb 21, 2003
    Messages:
    310
    Likes Received:
    0
    Trophy Points:
    16
    Use "Restore Multiple Backups" option in WHM.
     
  5. zentity

    zentity Well-Known Member

    Joined:
    Jun 16, 2004
    Messages:
    78
    Likes Received:
    0
    Trophy Points:
    6
    Restoring the accounts using the multiple restore option isn't the best thing if you have resellers on the machine, as restoring the accounts will generally mess the ip configuration up and the dns for the accounts restored via whm , making it a manual task to fix.

    Instead I have made script to restore the config files from the cpbackup/daily/files and cpbackup/daily/dirs and then use a script to untar the backups (user.tar.gz's) and move the user/homedir files to /home

    This will generally configure the box as it was pre restore - much better than using the multiple whm backup restores if you have resellers that use lots of ips and name servers.
    If you restore an account onto the wrong IP's and later change them, the clients could be in for longer downtime due to dns caching, so its genearlly good to get things right first off.

    If you look within the cpbackup/daily/files and cpbackup/daily/dirs you should be able to see what you need to restore where quite easily.

    Once you have restored the files and directories from cpbackup/daily/files cpbackup/daily/dirs you could do something like this to restore the /home/user files

    Change the backup directory to where yours are.

    Code:
    #!/bin/sh
    cd /backup/cpbackup/daily
    for user in `ls /var/cpanel/users`
    do
    tar xvzf /backup/cpbackup/daily/$user.tar.gz
    mv /backup/cpbackup/daily/$user/homedir /home/$user
    chmod 711 /home/$user
    chown $user:$user /home/$user
    done
    
    That would restore all accounts home files.

    Also if you do use the multiple account restore within whm instead, you can fill up your backup partition, since the files are untarred and you still have the original tar files there - taking up more and more space with each account restore. So watch that when you do a restore that way if you do, as you can find that the partition fills and your backups don't restore properly.
     
    #5 zentity, Aug 6, 2004
    Last edited: Aug 6, 2004
Loading...

Share This Page