Monday, August 2, 2010

All hail GNU Parted

A user bought in a dead laptop today. It was booting into Dell MediaDirect (an XP Embedded OS stored on the same disk as the main Windows XP install) instead of Windows XP, then bluescreening early in MediaDirect boot.

The user had accidentally hit the hardware button that boots the machine into MediaDirect instead of XP.

The machine booted fine under an Ubuntu live CD, and examination of the partition table quickly revealed that it was completely mangled. The primary partition that should've mapped Windows XP instead pointed to the same 2GB near the end of the disk that was mapped by the extended partition used by MediaDirect. So the partition table had two identical overlapping partitions, neither of which pointed to the real OS install.

The fix was trivial, thanks to GNU Parted.

$ sudo parted /dev/sda
rm
1
unit
%
rescue
0
100

In other words: Remove the primary partition (/dev/sda1) that should've been Windows XP, but instead pointed to MediaDirect (which was also on /dev/sda5). Then set units to percentage, and tell parted to scan the whole disk for lost file systems.

It'll find the original NTFS file system (for XP) and offer to add a partition for it. Easy.

You need to make sure the partition is flagged 'active' as XP's bootloader is a little dim. As I don't know parted well, I did this with:

$ sudo fdisk /dev/sda
a
1
w

... then rebooted into a working XP for the user.

The original cause is unknown, but perhaps this'll help others who've had MediaDirect mysteriously eat their partition table.

No comments:

Post a Comment

Captchas suck. Bots suck more. Sorry.