Ubuntus fsck messed with partition tables
Hi,
after a Windows crash Ubuntu performed a filessystem check and since then Windows won't boot anymore. This happened on a friends machine so I don't know exactly what he did.
The weird thing is that not even a Windows-CD will boot anymore. I tried all Windows (XP) CDs I could find and they all crash as soon as you press SPACE and they start analyzing the hardware.
I think this has something to do with the way Ubuntu works with extended partitions and I also found an easy way to reproduce the problem:
- get a SATA-drive that is not used anymore and clear its MBR with dd
- use gparted to create a primary NTFS partition and some logical linux partitions inside an extended partition
- gparted will ask you what type of bootrecord you wish to use.. I went with the default (MSDOS)
At this point no computer in which I put this SATA-drive will boot a Windows-CD (as long as there's no additional IDE-drive connected). The only way to make the drive work again with windows is to clear the MBR with "dd if=/dev/zero of=/dev/sda bs=512 count=1" and create at least one partition with the Windows install CD.
Now my friends computer is full of data and he doesn't want to reinstall everything (he has backups, though). So I'm looking for a way to get a new Windows installation without having to repartition the harddrive.
A nice soul on launchpad.net suggested the following (and I'm interested what you think):
- backup mbr
- clear mbr
- use testdisk to restore partition tables and hope for the best
Anyway.. when I ran sfdisk -V to check the extended partitions it gave me the following output and I wonder if there is a way to fix this:
# sudo sfdisk -V
partition [6]: start: (c,h,s) expected (1023,254,63) found (1023,0,1)
partition [7]: start: (c,h,s) expected (1023,254,63) found (1023,0,1)
/dev/sda: OK
Any ideas or further comments would be greatly appreciated!

When Ubuntu does a fsck, it
When Ubuntu does a fsck, it does not touch the partition table. I suggest whatever affected your partition table did so before Windows crashed.
Also, what exactly did you run to try to fix (fsck) the windows filesystem?
When you boot an Ubuntu live cd, can you browse the existing windows partition and see the data? I think that should be something to determine before trying to rescue this system intact.
Secondly, playing around with the partition table will not affect the actual data on the partition, so it's safe to do that. But if the filesystem is not in proper working order, a backup is needed. You cannot rule out hardware failure and anything you do to try to repair the filesystem (fsck or chkdisk) may lose data for you.
If you run into the slightest problem accessing the data, I suggest you image the drive and then work on the image.
I know I sound like a broken record because I seem to suggest that for almost every case, but that is the best way to proceed to avoid data loss.
I'm sorry.. I should have
I'm sorry.. I should have been clearer. All data is properly backed up, so we can mess with the disk directly. Either we get it working or my buddy has to reinstall everything anyway. So I'm just looking for better solution so that he doesn't have to waste so much time as this is his working computer (uses it with Ubuntu 99% of the time).
Okay.. so fsck didn't cause the problem. But it has to have something to do with the partition table. When I clear the MBR with dd the Windows-CD boots.. as soon as I put the old MBR back in place it won't. All partitions are properly accessable from the installed Ubuntu (and from live-CDs), including the NTFS partition. The only errors I can see is the message of sfdisk -V which I posted above.
The reason I thought Ubuntu somehow caused the problem is because I can reproduce the exact same behavior (Windows-CDs not booting) with the steps I posted above on any machine I tried so far.
Another idea from the launchpad.net thread was the following:
- backup mbr
- clear mbr
- boot windows-cd and create a single partition to install windows in
- quit the setup cd and boot a linux live-cd
- get a copy of the new mbr and compare both of mbrs
The problem is that I don't have very deep knowledge on the layout of MBRs so that I wouldn't know exactly what to look for and what tools to use (probably a hex editor).
BTW: I tried deleting the MBR and creating a new one with testdisk.. Unfortunately the testdisk MBR won't let Windows boot either.
You should repair the
You should repair the partition table with testdisk or otherwise clear the MBR and then boot the windows install cd and pick the recovery console and tell it to repair the MBR.