Monday, April 28, 2008

Installing windows on a laptop that had linux

At my office, most of the people use macs, and of the people that don't, most use windows but some use linux.

I don't really care what people use, but when someone wants a windows laptop and the only available hardware in our inventory used to have linux on it, I need to pop in the old windows installation cd and get windows installed, right?

Problem is, the windows installer CD will not install by default onto a hard disk that has linux on it.

Why not? I have no idea. I'm fine with it obliterating all the data - I want it to actually. But it will say "Setup is investigating your something or other..." then get stuck on a black screen. The installer doesn't really start.

The solution? Boot the machine with some linux install cd (or something similar that you have handy) and zero out the first part of the hard disk. The first 800MB did it for me (it did that before I could even hit ctrl-c, probably just a few MB is enough). It is not enough to just re-partition the drive without zeroing out some data. (specifically I popped a fedora core install CD into the drive, typed "linux rescue" at the boot prompt, told it to skip networking and skip finding linux installs, then at the root prompt said 'dd if=/dev/zero of=/dev/hda bs=1M', let it run for a second, then hit ctrl-c, then when the prompt came back, said 'exit' and rebooted)

After that, you can use the windows installation cd with no issues.

3 comments:

Brian P O'Rourke said...

I haven't seen the exact behavior you're describing, but I'd be willing to wager that Windows is trying to do something clever when reading the MBR, so when it sees your Grub or Lilo entry pointing to a Linux boot partition, it gets confused.

Anonymous said...

Never found this problem (then again, I never switch back TO windows - Eeek!) :-) But have you tried just running fdisk /dev/hda or whatever then deleting the partitions (d,d,d)? With an empty partition table it may not even try to examine your system configuration, even if the sectors are still there..

Unknown said...

i think the maxblast util avail from maxtor and also on ultimate boot cd has an option to zero out the first 100 sectors or something. that should be enough to get windows recognize it as a fresh disk.