Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Our mysql ibdata1 file was deleted earlier today. This wasn't noticed until mysqld was restarted and there was no data in the tables. The machine is a CentOs VM in Xenserver. At this point a snapshot was taken. Then the mysql database was dropped and restored from a backup. The backup not as current as I'd like it to be. I've been researching ways that ibdata might be recovered from the snapshot (ext3grep, undelete) and I briefly tried them on the machine after the snapshot but before giving up and restoring the old backups. I am looking at the snapshot now, trying to figure out how get it with making a live VM and mounting the filesystem.
I was wondering anyone had any advice or expereience if this is a pointless road to go down, or other suggestions.

Thank you.

share|improve this question
it seems to me that this is two questions: 1. how to access data in a snapshot (you probably need to access this as a block-device to be able to retrieve data which has been deleted from the filesystem). How to do this depends on how you access disk from xen, but from what you write i understand that you have access to the data already. 2. how to undelete data from an ext3-formatted block-device. Is this a precise understanding? What, exactly, do you need help doing? –  Rolf Rander Jan 20 '12 at 12:48
From the ext3-faq: In order to ensure that ext3 can safely resume an unlink after a crash, it actually zeros out the block pointers in the inode, whereas ext2 just marks these blocks as unused in the block bitmaps and marks the inode as "deleted" and leaves the block pointers alone. Your only hope is to "grep" for parts of your files that have been deleted and hope for the best. batleth.sapienti-sat.org/projects/FAQs/ext3-faq.html –  Rolf Rander Jan 20 '12 at 12:53
Thanks Rolf, I did see that FAQ but also the ext3grep page referenced that exact same thing and seemed to have some luck anyway. I am studying their site but without much hope. –  kswift Jan 20 '12 at 15:16
I'm not sure how ext3grep works, but in general I guess you can find some blocks of the original file if you know what to look for. However, with a large database file, it will be distributed over many blocks, brobably not in a continous area, and you need to find all of them and assemble them in the right order to get a readable database. –  Rolf Rander Jan 20 '12 at 16:54
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.