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!

How can I backup home directory and database in sync?

Discussion in 'Data Protection' started by MrCanada, Dec 23, 2017.

Tags:
  1. MrCanada

    MrCanada Member

    Joined:
    Dec 23, 2017
    Messages:
    11
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Canada
    cPanel Access Level:
    Root Administrator
    Recently I learned how to use cPanel "Backup" feature. I am using it to back up my Home Directory and my MySQL Database. If I use the option to Download a Full Website Backup (which includes the home directory and the mysql database), will the home directory be synchronized with the mysql database? For example, my database holds references to image files in the home directory. Is it possible for someone to upload an image coincidentally while the backup is happening causing my database and file system to be out of sync? Or is the system completely locked while the backup happens to guarantee the home directory and database stay in sync? Maybe there is another proper way to do this that I am missing? I just want to make sure all of my data is backed up in snyc.
     
  2. rpvw

    rpvw Well-Known Member

    Joined:
    Jul 18, 2013
    Messages:
    823
    Likes Received:
    299
    Trophy Points:
    113
    Location:
    Spain
    cPanel Access Level:
    Root Administrator
    If your website application has a 'maintenance mode' that you can switch to, that tells users that the site is temporarily off-line - use that - or set up a temporary htaccess redirect to redirect everything to a simple html 'off-line' page.

    Either should ensure no user can log in and upload files via the website application.

    A user logging into their cPanel or FTP and uploading whilst you are performing the backup may give rise to the situation you describe, and I really don't know if there is any easy way of ensuring that this cannot happen. Conventional advice is to take backups at a time when no-one would likely be doing anything, but with sites serving a global market, this isn't always possible.

    If cPanel doesn't lock everything during a backup, perhaps a feature request would be in order.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    cPanelMichael likes this.
  3. MrCanada

    MrCanada Member

    Joined:
    Dec 23, 2017
    Messages:
    11
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Canada
    cPanel Access Level:
    Root Administrator

    Temporary .htaccess redirect to prevent anyone from uploading during the backup. Didn't even think about that. Thanks!
     
  4. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,803
    Likes Received:
    1,897
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello,

    I'm glad to see that solution works. Note to answer your original question, the website files and MySQL databases are backed up separately during the backup process, so it is possible the data might not be synced if new files are added in time frame between the backup of the website files and databases.

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice