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.
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.
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!)