View Single Post
  #1   (View Single Post)  
Old 27th January 2012
jggimi's Avatar
jggimi jggimi is online now
More noise than signal
Join Date: May 2008
Location: USA
Posts: 6,292
Default The art of recovery -- grumble and moan

We back up our systems out of fear. We restore them in a panic.

This week, through a finger fumble, I destroyed the metadata of my NTFS partition on my netbook. For the past two years. this little thing has been my primary personal use workstation at home or when traveling.

I multiboot three OSes; OpenBSD is general purpose, Ubuntu is for mucking about with Android kernel/userland builds, and I keep Windows because I need it for a few specific applications.

I had to try to recover Windows, or reinstall it.

  • I have XP media in only two forms -- an older Microsoft XP SP2 installation CD, and a "Recovery" DVD from Asus, the netbook's manufacturer.
  • The netbook doesn't have an optical drive, and I don't own a USB one.
A qemu virtual machine came to the rescue. I copied the XP CD to an .iso file on my NFS server with dd(1) and then, from OpenBSD on the netbook, I booted the .iso file over the network mapping my physical hard drive into a virtual one:

# qemu-system-i386 -boot d -cdrom=/mnt/xp.iso -drive file=/dev/rsd0c,cache=none

The recovery application on the install CD ran, but it could not repair the partition; I'd destroyed enough that Windows needed to be re-installed.

Using the same virtual machine, I ran an install for the NTFS partition. But ... the install makes driver choices based on the hardware it sees at the time. A Qemu virtual machine with a Bochs virtual BIOS is not at all the same as the real hardware. SP2 was installed, but it would not boot natively, and went straight into a BSOD.

I needed to use the Recovery DVD from within qemu, in the same manner. That would lay down a prebuilt Windows image for the Asus netbook. But to do that, it would wipe the drive. So I I had to first install BSD into an external hard drive, boot that, install qemu, and try again.

The recovery DVD requires more RAM than the 128M default, so:

# qemu-system-i386 -boot d -cdrom /mnt/asus.iso -drive file=/dev/rsd0c,cache=none -m 300

Since this is a pre-configured Windows image, it booted natively. Success!

After that, I booted an Ubuntu installation stick, shrank the NTFS partition to a useful size, and then installed Ubuntu.

For Windows and Ubuntu, I have files to restore.

Next steps: restore OpenBSD and install its boot blocks, then install GAG, my preferred boot manager.
(GAG runs fine, but it has it has intermittent trouble saving its configuration changes to my SATA drive even when the drive is set to legacy IDE in the BIOS. Whatever the cause, the problem is easily circumvented: qemu to the rescue, again. The drive I/O is performed by the OS, not by GAG, and so GAG has no trouble writing to disk.)
Always have a plan for recovery of all your systems. In advance!! Hey, but this was just some personal use stuff; and I let it slide. I didn't have a plan for Windows. And that hurt, because having to to use the Recovery DVD meant I had to wipe the drive. This complicated and extended the time and effort to return to normal operation. Which is still not yet done.

Last edited by jggimi; 27th January 2012 at 02:22 PM.
Reply With Quote