Reconstructing user database from raw files
Greetings, I recently had a hard disk get corrupt after a kernel panic and can no longer boot to it. I mounted this drive as a secondary drive to another server and can see all the data files for the mysql databases in /mnt/var/lib/mysql/ for each cPanel user. I have an old snapshot of the drive that I rebooted to and wanted to update the databases for the sites as the old ones are two years old, however, all I have are the raw files. When I move these files from the recovered disk to the backup disk mysql gives an error. Is there a way to reconstruct the databases with the raw data files into a SQL file in order to update the old ones? Would mysqldump be able to do this? Thank you.
-
when you say "have are the raw files" does that mean that you have the current MySQL folder I would try backing up anything that's on the new server that you need to keep then stop mysql ( be sure to disable it In WHM do it does not restart mv /var/lib/mysql/ /var/lib/mysql-old ( just in case you want to revert back) then rsync the entire /mnt/var/lib/mysql/ back to /var/lib/mysql/ cross fingers & restart mysql Possibly adding the innodb_force_recovery=X at each level if it does not start There are some recovery tools in the innodb thread on this form you can try but I would try above first 0 -
I was not able to use rsync as it gave me input/output errors when reading the files. I tried setting up another instance in AWS and attached the drive and manually copied over a user database into the /var/lib/mysql directory and started mariadb with no issues. When using show databases and tables the information comes up, however, when using mysqlcheck I get the same type of errors: can't find file. This tells me that data within the tables are corrupt and can't be repaired. Conclusion The good: I have learned a ton during this recovery process. The bad: I will more than likely not be able to recover the database data. I would suggest to always make backups before trying to extend storage to any partition table. The only other option now is to try and repair / rebuild the original drive to become bootable again. ------------------------------------------------------------------------------------------------------------------------------------------------ Thank you for the help and suggestions! Cheers! 0 -
I would suggest to always make backups before trying to extend storage to any partition table.
There are two major things in this sentence I want to point out: 1. you should absolutely ALWAYS be taking backups. Especially before making changes to the server but you should be making them regularly. 2. Extending storage to a partition table is a sensitive modification and isn't necessarily recommended to do, to begin with, unless you're well versed in making these kinds of modifications I do hope you're able to retrieve the data off the drive, you might want to contact a system administrator to discuss potential options. If you don't have one available you might find one here: System Administration Services0
Please sign in to leave a comment.
Comments
4 comments