-   Linux - Hardware (
-   -   Gparted -- Error: Can't have a partition outside the disk! (

1veedo 12-22-2012 03:06 PM

Gparted -- Error: Can't have a partition outside the disk!
So I installed Windows 7 on this laptop and when I fixed grub and booted back into Fudundu I found to my amazement that one of my partitions had disappeared. Instead there was 80GB of free space exactly where that partition used to be.

(Causing Fudundu to fail to boot until I commented out that entry from fstab)

So I went over to TestDisk's site and managed to kind of restore my partition table... the old /etc/fstab file with the old UUID for that partition works and everything mounts properly.

The only problem is after I wrote the partition table using TestDisk, gparted doesn't show any partitions at all on /dev/sda. Fdisk shows the partitions but also shows some strange W95 Ext'd (LBA).


fdisk -l -u=cylinders

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: 0xa8a8a8a8

  Device Boot      Start        End      Blocks  Id  System
/dev/sda1  *          1          13      102400    7  HPFS/NTFS/exFAT
/dev/sda2              13      10444    83783680    7  HPFS/NTFS/exFAT
/dev/sda3          10445      30402  160312635    f  W95 Ext'd (LBA)
/dev/sda5          13055      23528    84130816  83  Linux
/dev/sda6          23529      24573    8393920  82  Linux swap / Solaris
/dev/sda7          27576      28097    4192932  83  Linux
/dev/sda8          28098      30402    18505728  83  Linux

After checking google it turns out what's happening is /dev/sda3 (extended) and /dev/sda8 (Fuduntu) are marked as being physically past the last cylynder on the harddrive.

My problem is I cant seem to figure out how to fix it. There's a solution given here but I'm scratching my head trying to figure out how to get it to work in my case.

Here's sfdisk -d for reference


# partition table of /dev/sda
unit: sectors

/dev/sda1 : start=    2048, size=  204800, Id= 7, bootable
/dev/sda2 : start=  206848, size=167567360, Id= 7
/dev/sda3 : start=167782860, size=320625270, Id= f
/dev/sda4 : start=        0, size=        0, Id= 0
/dev/sda5 : start=209715200, size=168261632, Id=83
/dev/sda6 : start=377977383, size= 16787840, Id=82
/dev/sda7 : start=442992438, size=  8385864, Id=83
/dev/sda8 : start=451381248, size= 37011456, Id=83

And parted /dev/sda print

Error: Can't have a partition outside the disk!                         
Model: ATA WDC WD2500BEKT-6 (scsi)
Disk /dev/sda: 250GB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags:

1veedo 12-22-2012 05:43 PM

Ok so while it looked like both the extended partition and one of the logical partitions went past the disk, looking at just the sector numbers, it looked more like /dev/sda8 was inside the harddrive with only the extended partition being off.

So what I did is subtract the last sector number of the last logical partition (sda8) from the beginning of the extended partition, added 1, and ran this command (from here):


echo "209715156,278677548,f" | sudo sfdisk -f -uS /dev/sda -N3 -O
The reason I added 1 to the second number is because after the first try (209715156,278677547) the extended partition stopped one sector short of the last logical partition.

So the way this command works is the first number is the beginning of the partition and the second number is how large the partition is (which includes the first sector) so that N1 + N2 - 1 = the final sector of the partition. If you have another partition after your extended partition I imagine you'd put it one sector before the beginning of that one.

The other parameter is the -N which is what partition you're working on. -N3 being /dev/sda3, -N4 being /dev/sda4 etc.

The output file is some kind of backup that you should put someplace other than the harddrive you're working on (although I'm not sure how to use it if the command fails).

After running the command gparted looks exactly like it did before I ran testdisk except I actually have my lost partition instead of unallocated space.

This seems kind of like a bug with testdisk, being that testdisk is what wrote the extended partition there (although it also recovered the partition that Windows decided to delete).

EDDY1 12-23-2012 02:41 AM

Although you've solved the problem,I would consider backing up my files & reinstalling.

Fdisk shows the partitions but also shows some strange W95 Ext'd (LBA).
It's just the extended partition

Are all of your partitions back, because there' free space between 10445 & 13055

/dev/sda3 10445 30402 160312635 f W95 Ext'd (LBA)
/dev/sda5 13055 23528 84130816 83 Linux

All times are GMT -5. The time now is 04:35 PM.