Community Forums
Connect with us on LinkedIn
Community Notice
+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Member SuperBaby's Avatar
    Join Date
    Nov 2003
    Location
    Malaysia
    Posts
    306

    Default How to do complete restore from .tar.gz file?

    I have an old backup file (xxx.tar.gz) for the domain abc.com in a remote server. This backup file was created by the WHM daily/monthly backup. This account has been terminated. How do I do a complete restore including webpages, MySQL, chmod values etc? The old username and domain name will be used?

    Do I simply do a decompression OR do I create a new cPanel account and restore from there? In either method, how exactly?

    Thanks.
    SuperBaby

  2. #2
    cPanel Product Evangelist Infopro's Avatar
    Join Date
    May 2003
    Location
    Pennsylvania
    Posts
    7,166
    cPanel/Enkompass Access Level

    Root Administrator

    Wink

    You might find these docs useful. WhmBackup < AllDocumentation/WHMDocs < TWiki

  3. #3
    cPanel Quality Assurance Analyst cPanelDon's Avatar
    Join Date
    Nov 2008
    Location
    Houston, Texas, U.S.A.
    Posts
    2,554
    cPanel/Enkompass Access Level

    DataCenter Provider

    Lightbulb Re: How to do complete restore from .tar.gz file?

    Quote Originally Posted by SuperBaby View Post
    I have an old backup file (xxx.tar.gz) for the domain abc.com in a remote server. This backup file was created by the WHM daily/monthly backup. This account has been terminated. How do I do a complete restore including webpages, MySQL, chmod values etc? The old username and domain name will be used?

    Do I simply do a decompression OR do I create a new cPanel account and restore from there? In either method, how exactly?
    A full account backup may be restored and at the same time the account can be created; this may be performed using the following script via root SSH access; running the script without any CLI switches or options will show help and usage information:
    Code:
    # /scripts/restorepkg
    To restore a specific backup archive, simply enter the same command followed by the location to the full cPanel account backup archive as seen in the following example (where "/path/to/filename.tar.gz" should be replaced by the full file system path to the backup archive):
    Code:
    # /scripts/restorepkg /path/to/filename.tar.gz
    The same restore task may also be accomplished using WHM via the following menu path:
    WHM: Main >> Backup >> Restore a Full Backup/cpmove file
    Documentation: Restore a Full Backup/cpmove File

  4. #4
    Member SuperBaby's Avatar
    Join Date
    Nov 2003
    Location
    Malaysia
    Posts
    306

    Default

    Thank you for such a good instruction. It clears all my doubts. BTW, does it retain all the chmod values? Thanks again.
    SuperBaby

  5. #5
    Member
    Join Date
    Nov 2009
    Posts
    16

    Default

    Hi this is a great question. I wanted to add onto it.
    If we have a cpanel already and want to restore a daily/weekly backup for it, do we need to delete that account first and then do the restore?

  6. #6
    Member
    Join Date
    Apr 2009
    Posts
    230

    Default

    Quote Originally Posted by SuperBaby View Post
    I have an old backup file (xxx.tar.gz) for the domain abc.com in a remote server. This backup file was created by the WHM daily/monthly backup. This account has been terminated. How do I do a complete restore including webpages, MySQL, chmod values etc? The old username and domain name will be used?

    Do I simply do a decompression OR do I create a new cPanel account and restore from there? In either method, how exactly?

    Thanks.
    If the account is going to be on another server then rsync the backup file to that server and move it to the /home directory.
    If it is on the same server, then move the file to the /home directory.

    Assuming that the tar.gz file is now available in the /home directory on the server where it will be restored, run the following command as root :
    Code:
     /scripts/restorepkg username --force
    Replace username with the actual username(old account)

    This will automatically create the account and restore all your webfiles, databases,emails etc.

    If you want to modify the username then once the restoration is complete, do the following :

    Code:
     vi /var/cpanel/users/username
    Change the USER here and run :

    Code:
     /scripts/updateuserdomains

  7. #7
    cPanel Quality Assurance Analyst cPanelDon's Avatar
    Join Date
    Nov 2008
    Location
    Houston, Texas, U.S.A.
    Posts
    2,554
    cPanel/Enkompass Access Level

    DataCenter Provider

    Lightbulb Forcefully restoring a full account backup and changing an account username

    Quote Originally Posted by InstaCarma_Tech View Post
    ... Assuming that the tar.gz file is now available in the /home directory on the server where it will be restored, run the following command as root:
    Code:
    /scripts/restorepkg username --force
    Replace username with the actual username(old account). This will automatically create the account and restore all your webfiles, databases, emails etc.
    Note: The CLI switch "--force" (for the script "restorepkg") is only necessary if needing to forcefully overwrite an existing account that is already setup or in-place (e.g., with the same username and primary domain as what's in the backup).

    Quote Originally Posted by InstaCarma_Tech View Post
    If you want to modify the username then once the restoration is complete, do the following:
    Code:
    vi /var/cpanel/users/username
    Change the USER here and run:
    Code:
    /scripts/updateuserdomains
    Cautionary Warning: The two-step process shown above (quoted in "CODE" blocks) is not a safe method to change an account username. There is more that must be done including, but not limited to, tasks such as renaming databases and database users, and updating cPanel userdata and related cPanel configuration files.

    To properly change an account username and related cPanel configuration files for the account the following feature should be utilized from WHM, via either "root" access or via reseller access if granted sufficient privileges by root:

    Menu path, WHM: Main >> Account Functions >> Modify an Account
    Documentation: ModifyanAccount < AllDocumentation/WHMDocs < TWiki

Similar Threads & Tags
Similar threads

  1. [Case 45599] Can't Extract .tar file in cPanel File Manager
    By voezie in forum New User Questions
    Replies: 4
    Last Post: 07-22-2011, 10:10 AM
  2. restore incremental backup from shell without tar
    By syslint in forum Data Protection
    Replies: 7
    Last Post: 09-03-2010, 06:51 PM
  3. getting accounts from .tar file
    By Reacted in forum Data Protection
    Replies: 7
    Last Post: 12-10-2007, 09:15 PM
  4. Restore Complete Backup
    By Doctor in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 12-05-2003, 02:02 AM
  5. Anyone know how to transfer a 9 gig tar file.
    By DWHS.net in forum cPanel and WHM Discussions
    Replies: 4
    Last Post: 09-10-2003, 02:39 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube