SOLVED WMH backup - restore /system files spec _var_lib_mysql.tar

Kirk_C

Member
Dec 2, 2020
10
3
3
USA
cPanel Access Level
Root Administrator
Hitting wall here. I do a full server back daily to remote location, creates (date) folders with /accounts and /system directions (conf WAS set to Entire MySQL Directory). So far so good, daily backups no issues.

On Dec 1st had server re-imaged to CENTOS 7.9 v86.0.32 and restored /accounts back w/ no issues EXCEPT no MYSQL db's were restored. NOTE now I have backups set to (Per Account and Entire MySQL Directory).

I noticed a _var_lib_mysql_.tar file in /system. From little info I had I extracted files into matching directories. As they say, that didn't end well.

Can anyone point me in the right direction? Only need to restore just the four accounts db for wp website stuff.

Thanks in advance.
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
7,519
1,028
313
cPanel Access Level
Root Administrator
Hey there! When a cPanel account is restored I would also expect that to restore the databases. If that didn't happen, it sounds like there may be other issues. Would you happen to have access to that restore log, if that work was performed through WHM?

The .tar file you discovered is more of a disaster-recovery style backup, as it's a flat file copy of the /var/lib/mysql directory. It's not nearly as easy to restore from that, and not something we usually recommend.
 

Kirk_C

Member
Dec 2, 2020
10
3
3
USA
cPanel Access Level
Root Administrator
Normally the db would be recreated on restore but I had the back up set to {Entire MySQL Directory} instead of {Per Account and Entire MySQL Directory}. So it didn't add db info to account back up tar instead backup puts the {Entire MySQL Directory} in with /system_files creating the _var_lib_mysql_.tar file which is the entire /var/lib/mysql contents. The files are complete and not corrupt. Just not knowledgeable on how to manually restore, WHM help doesn't cover this.
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
7,519
1,028
313
cPanel Access Level
Root Administrator
The best way to try and get that working would be to unzip the backup file with a command like this:

Code:
tar -zxvf /backup/2020-12-02/system/dirs/_var_lib_mysql_.tar.gz
and then completely replace the existing /var/lib/mysql directory with those contents, instead of trying to merge them. Can you try that and see if that provides better results?
 

Kirk_C

Member
Dec 2, 2020
10
3
3
USA
cPanel Access Level
Root Administrator
Well that didn't work at all. Still confused why WHM would do a full db backup to /system/_var_lib_mysql_.tar then not have instructions or a tool to restore. It creates /var/lib/mysql dir with everything from old server but just replacing that dir on new server don't work. MySQL doesn't recognize files and phpmyadmin is totally confused when starts. This is beyond frustrating, it shouldn't be this difficult.
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
7,519
1,028
313
cPanel Access Level
Root Administrator
The "Entire directory" option is more of a disaster-recovery style backup and there just isn't as automated a way to restore this. We have a link to the MySQL documentation here on how you may be able to get that working:


but there aren't any automated tools available for that type of work, unfortunately.
 
Thread starter Similar threads Forum Replies Date
R Backups 1
benito Backups 2
H Backups 3
T Backups 3
P Backups 1