When all else fails, the Hail Mary pass can sometimes actually WORK….

Like many of you, I like to have some of the latest technology at my fingertips. Specifically, I’m talking about my workstation. No, while I don’t have über-fast sexy hardware, I like to at least have the latest OS flavor(s) installed so I can play with new features.

The other day I decided it was “time” for Fedora 12. Time to play with ext4.

Before I begin, a small word about my prior setup:

disk 1: Windows XP, NTFS partition. Old, crusty, not used anymore, as I have XP in a VM now.
disk 2: Fedora 11, Linux LVM partition. No real data of value, but it does house my XP vm.

As long as I was updating to Fedora 12, I also decided that for my ‘occasional’ Windows use, the XP partition could go away. I have Windows in a virtualbox VM, so why not? My plan was simple: Install Fedora 12 on disk 1 (wipe the old XP setup). Once booted, copy my other files from the Fedora 11 setup as needed (like, my virtualbox disks, my email, my documents, etc).

But– something went wrong, very wrong.

When I was all done (and don’t ask me exactly how this happened) – the contents of my Fedora 11 LVM were… gone. Huh. OK, plan B. Booting back to my Fedora 11 partition? No dice, it was all gone. And no, I didn’t have a backup of my Fedora 11 partition. Why would I? My Fedora 12 install wasn’t supposed to touch it.

With the amount of work I had in my Fedora 11 setup that I wanted to keep (see next paragraph)– I tried everything. Pvscan DID find the physical volume, but that was all. Vgscan and subsequent tools saw NOTHING on the physical volume. All traces of the volume group and the logical volume that had my former linux setup was toast.

Before I tried this next step: I kissed my old data goodbye. I realized after the fact that while I *thought* didn’t have any critical data there – I *did* have a Windows XP virtualbox disk image that I now realized had actually taken quite a bit of time to set up. You know, get it all installed, patched, MS Office, blah blah. I dreaded having to start over to re-create a windows environemnt that I only occasionally needed, but needed nontheless.

Once I put myself in the mindset of “it’s gone”, I then proceeded to try ONE more thing.

I knew that the disk was a typical fedora setup– an LVM, with the root file system, occupying the entire disk. What if I re-created the volume group and logical volume – could my data still be there somewhere?

Step 1: I used vgcreate to create the volume group. I used the standard default name, VolGroup00.
Step 2: I used lvcreate to create the logical volume. Max volume size. Again, using the default name Fedora utilizes (LogVol00).
Step 3: Normally, this is where you to “mkfs”. Instead, I tried an fsck on the logical volume.

Crunch crunch crunch. Whirr Whirr whirr. And all my data magically reappeared.

File THAT in your emergency sysadmin toolbox, kiddies!