Revision of Case Study: Unformattable drive from Tue, 05/31/2011 - 10:57

Summary: Windows XP cannot install on a computer running a non-windows operating system.

Details: During the installation procedure, the drive's partition table is accessible and modifiable, but the newly installed Windows XP operating system does not boot.

The problem is that the former operating system's bootloader is installed on the MBR and the XP installation disc assumes that standard DOS boot code is present, simply marking the XP partition as bootable and assuming the bios will start Windows when the machine powers on. In this case, the BIOS executes the boot code which looks for the previous operating system.

The solution is to either write a DOS MBR to the first 440 bytes of the drive, or completely erase the first 512 bytes which will wipe out the MBR and partition table. Windows will assume the drive is blank and properly install an MBR on it.

cat /proc/partitions

This will list the partitions present on the computer. Find the appropriate device. Here, let's assume it's sda.

sudo dd if=/dev/zero of=/dev/sda bs=512 count=1

That's it. You have removed the MBR and partition table.

You may also try installing an MBR onto the drive. The Syslinux package contains an MBR.bin file that can be written to the begining of the drive.

sudo apt-get install syslinux

cd /usr/lib/syslinux/

cd dd bs=440 count=1 if=mbr.bin of=/dev/sda

If you are writing the mbr to an image file, use the following

cd dd conv=notrunc bs=440 count=1 if=mbr.bin of=/media/disk/image

where the image file is a file on a drive mounted at /media/disk.