I ran an old version of the windows fdisk tool on a drive with 4 partitions (the 4th one was just unpartitioned space). I used it to format the last partition into FAT32 and then set that partition to active. Afterwards I tried installing XP on that 4th partition, but it didn't work. Now, my computer won't boot because an empty partition is set to active and fdisk won't set it back.

I ran Ubuntu 10.10 LiveCD and I was worried when I realized that gparted sees my drive as unallocated, and lists an error message "can't have overlapping partitions".

Here is the output from fdisk -l:

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xd83b5f0d

Device Boot Start End Blocks Id System /dev/sda1 1 1127 9043968 27 Unknown /dev/sda2 1127 1139 102400 7 HPFS/NTFS /dev/sda3 1139 54428 428037144 7 HPFS/NTFS /dev/sda4 * 54428 60801 51199155 c W95 FAT32 (LBA)

I'd like to get rid of /dev/sda4 and set /dev/sda2 as active, as it was before, and I hope that will let me boot back into my existing installation of windows 7. However, I am afraid of doing anything to the drive, since my critical information is on /dev/sda3 and I'd rather not lose it... Is there any way to undo whatever that old W95 fdisk did to my drive?

Thanks in advance!

PS: I'm running an ubuntu 10.10 liveCD right now and I can read the contents of /dev/sda3 just fine, which is a big relief, at least until I find a solution!

  • Glad you found a solution. In general it's a good idea to back up before changing any partition data!
    – CarlF
    Apr 25 '11 at 20:41

I am Alex who posted above. I fixed my problem so I figured I'd write out my solution in case anyone runs into the same thing.

First, for completeness, I'll mention that the Ubuntu disk utility was giving me extremely weird information that I didn't include in my first post: it showed two 438GB partitions one after the other on a 500GB hard drive. After the second 438GB partition, there were two unformatted partitions.

The solution to my problem was to download Ubuntu Rescue Remix 10.10, burn the liveCD and run the testdisk tool. Here is a walkthrough (pretty much the same as http://www.cgsecurity.org/wiki/TestDisk_Step_By_Step):

sudo -s
testdisk /list

In testdisk, I went with "no log", then chose my drive, chose "intel" which was the right type for my PC, then "analyse" and "quick search". I was very disappointed to see the results returned by quick search -- only the very first partition, the recovery partition on my PC, could be saved (check each partition by selecting it and pressing p, if the files on the partition are readable it is recoverable). That is why I went on to choose "deeper search".

"Deeper search" was the holy grail, as it found the other two partitions in working order as well! I checked them by pressing "p" and the partitions were readable. I changed each of them from "D" (deleted) to "P", marked my boot partition as "*" and finally pressed Enter, then "write" and wrote the restored partition table.

Note: to save time, you can interrupt the deeper search after you think it has found what you are looking for. I knew the first 3 partitions started before cylinder 2000, so they had been discovered by then and I stopped the search. I didn't care about the fourth partition.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.