I recently had a virtual server crash that was using LVM as the disk on which the VM was installed. To complicate matters even further the virtual machine was using LVM formatted with ext3 for it’s file systems. I had 25 GB of music on here that I did not want to lose so I was bent on figuring a way out of my dilemma.

I eventually ran across an application called testdisk. Testdisk turned out to be the answer to my problem. Although not very intuitive and lacking in documentation I am going to lead you through using the testdisk application in case you ever need it.

Testdisk runs as a static application. All you need to do is download and extract it. Once it is extracted cd into the directory call linux. Execute the program testdisk_static followed by device path of the disk from which you want to recover data. Shown below is the command that I used.
./testdisk_static /dev/linux-virtuals/music.repo

The first screen that you see will look like the following screenshot. The disk from which you want to recover should be highlighted. Click on proceed to bring up the next screen.

Choose Intel as your disk type unless you know that you are using one of the other types listed.

On the next screen hit enter to have test disk analyze analyze your partition.
Test disk to perform a quick search of your partiton. After you hit enter you are asked if you want testdisk to look for Vista partitions. Click no unless you have Vista partitions.

A short list of the partitions that testdisk found will show on your screen. Click enter to continue.

On this screen you will be prompted to continue a deeper search. Click enter to have testdisk thoroughly search the partition and find anything that is deleted. This may take awhile to complete depending on the size of the partition.

Once it is finished it will let you know. This is where things can get a little tricky. Scroll down through the list of partitions until you find one that is marked with a P in the legend below the list. Click P to see the list of files contained in that partition. Note that not all listed partitions will show the P in the testdisk legend. If they don’t there isn’t any data their to collect.

Once you’ve pressed the P you will see a list of directories. Highlight the directory where you believe your files are and hit enter. You will have to work down through the original directory structure that you had on disk. If those don’t contain the files use the right arrow key to back your way out to the top level of the file system. Scroll down until you find another partition marked with a P and check it for your files.

An Voila! Here is my music. At the bottom of the screen you are told to hit copy. If you want the whole directory back up one level by hitting the left arrow key. Highlight the directory to copy it by pressing c. This will bring up a list of your current working directory. Keep hitting the left and down arrow keys until you are in the directory where you want to save your recovered files.

Hope this helps. Everything I’ve ever read said ext3 couldn’t be recovered. Don’t believe it-here it is in black and white. So go get those files that you didn’t back up! (Yes I learned my lesson.. here comes Amanda or Bacula or Backup Manager!)

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States.
Privacy

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States.
Privacy

Processing your reply...

About This Blog

Insight, commentary and examples of applications, scripting and industry news about Linux and open source software. Articles will cover installation and setup of various applications with a focus on open source and Linux.