Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I recently had trouble with the MBR/partition table on my laptop. I managed to rebuild the partition table using testdisk, and install GRUB to get it booting properly again (I'm using a dual-boot with Windows 7). However, I can no longer run gparted properly as I get the error Can't have a partition outside the disk!.

fdisk -l output looks like this:

Disk /dev/sda: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 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: 0x188f12a9

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1         154     1228800    7  HPFS/NTFS/exFAT
/dev/sda2             154       13446   106775171    7  HPFS/NTFS/exFAT
/dev/sda3           13447       28745   122880000   83  Linux
/dev/sda4           28745       30402    13317664+   f  W95 Ext'd (LBA)
/dev/sda5           28745       29127     3069944   82  Linux swap / Solaris
/dev/sda6           29127       30402    10240000    7  HPFS/NTFS/exFAT

So the disk has 30401 cylinders, but sda6 ends at cylinder 30402; presumably that's where the problem is.

When I run testdisk it has the 6th partition ending at cylinder 30401, but writing it to the partition table does not make any difference.

Is there an easy way to fix this?

I've read elsewhere that I could fix this by manually editing the partition table, but I'd like really specific instructions as I don't really know much about this area!

share|improve this question
Are you able to run gparted /dev/sda6? Can you run the partition editor off a Live CD? Otherwise manual may be the way to go... – Rasman Jun 14 '11 at 14:46
The same thing happens when using a Live CD. I'll try gparted /dev/sda6 tonight. – jwaddell Jun 14 '11 at 22:45
up vote 7 down vote accepted

Use fdisk. Put it into sector mode with the u command, then p to print the table, d to delete the partition, and then n to recreate it. When you recreate it, use the same starting sector, but an ending sector that actually fits within the disk. When you are done and have double checked ( p again ), save and quit with w.

share|improve this answer
It turned out to be the extended partition that was the problem, but fdisk worked well to recreate it and the logical partitions inside it. gparted now opens correctly. – jwaddell Jun 18 '11 at 10:51

Download and install Boot Repair, an automated recovery tool that usually solves these kind of problems.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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