Background: I run multiple VirtualBox client within a single server. Each VirtualBox client coming with its *.vdi file for sure. Accidentally I run rm to them during migration and backup, and so some *.vdi are lose. I need to rescue them.
Most important action for rescue: unplug the server power and shut-it-down IMMEDIATELY! Try not to preform ANY write action to the target harddisk ANYMORE!
Next, I googling and figure out that foremost may give me a hand. So I will need a Ubuntu in Live-CD and boot up a system for rescue besides loading my target drive directly. Soon after that I figure out ext3grep and seems much better for my target.
foremost
I am now running the scan and hopefully it can get my data back. Here are some procedures about the work:
- Unplug the power of server IMMEDIATELY!
- Get an Ubuntu Live-CD. I am using 9.04 Desktop edition. We don't care about the version.
- Boot the system with Live-CD.
- After login, first update aptitude package list with:
aptitude update - Now install foremost and sshfs (for remote backup):
apt-get install foremost sshfs - Reference to Tutorial: All about VDIs and figure out its header format (I use hexdump to correct *.vdi for the correct header). Manually add the *.vdi extension to
/etc/foremost.conf, e.g.:
vdi y 137438953472 \x3c\x3c\x20\x3c\x75\x53\x20\x6e \x00\x00\x00\x00\x00\x00\x00\x00 - Mount your remote drive and prepare for the restore.
- Run foremost as example:
cd dir_where_you_mount_your_remote_drive_with_sshfs
foremost -d -v -T -i /dev/sda3 - Go for a lunch or bath or coffee break or something else. Remember that foremost is now scanning the WHOLE drive and so it will take for a VERY long time!
ext3grep
Well... I am now trying to recover as newbie... Hopefully it can help:
ext3grep /dev/sda3 --restore-file home/groups/filename_to_be_restoreI am also seeking for other solutions, too. If you have any idea please let me know :S
UPDATE (20090731): Finally ext3grep is functioning and all files are successfully recovered. As they are *.vdi, after restore and bootup VirtualBox client, it is recommened to run fsck for every drives. To force fsck during system boot, run the following command and reboot the Linux:
touch /forcefsck
















