Ubuntu – GParted shows “unallocated” on the sda drive (parallel boot with Win XP)

gpartedgrub2windows xp

This question is similar to others, but none of the answers was conclusive for my case.

I have Windows XP installed on my laptop by default and later on I installed ubuntu 10.10. Grub2 is my bootloader and I can boot into both Windows and Ubuntu.

However, recently I decided to give my Ubuntu partition more space. I opened GParted but it only shows me "unallocated" for my sda drive (only drive in the laptop).

Running System->Administration->Disk-Utility I can see all my partitions

sudo parted -l gives:

Error: Cannot have a partition outside the disk

Yesterday I stared an attempt to fix this, but ended up destroying grub2 which required some reinstall-trickery. I also installed Boot-repair, but it only says something along the lines of:

Use a 64bits version

My system is 32bit, no doubt about it.

Just to complete everything, this is the fdisk output:

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 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: 0xdcdcfe52

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1         912     7325608+   7  HPFS/NTFS
/dev/sda2             913       10639    78132127+   7  HPFS/NTFS
/dev/sda3           10640       17544    55464381    7  HPFS/NTFS
/dev/sda4           17545       19458    15374205    f  W95 Ext'd (LBA)
/dev/sda5           17545       17756     1697860   83  Linux
/dev/sda6           17756       19380    13046784   83  Linux
/dev/sda7           19380       19458      621560   82  Linux swap / Solaris

(HDD was originally split half and half in a C: and D: drive. I used a part of the C:\ partition to install Ubuntu)

How can I fix my patitions in a way that GParted can find them again?

Best Answer

Please follow this link http://ubuntuforums.org/showthread.php?t=1728998 In short just follow this steps:

You need FixParts utility. You can either download the appropriate fixparts Debian file from SourceForge or install the full gptfdisk package for your version of Ubuntu (see the "Downloading GPT fdisk from OBS" section of this page). Then:

Back up your data, or at least your partition table. (Your sfdisk output above backs up your partition table, so save that on another disk.)
Type "sudo fixparts /dev/sda".
In FixParts, type "p" to view your partitions and verify they're all present. The extended partition won't show up, but the logical it contains should. 
In FixParts, type "w" to save your partition table.

This procedure should fix the problem.