Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Hardware
User Name
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?


Search this Thread
Old 12-22-2012, 03:06 PM   #1
Registered: Dec 2004
Location: WV, USA
Distribution: Gentoo, Debian
Posts: 186

Rep: Reputation: 34
Exclamation 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:

Last edited by 1veedo; 12-22-2012 at 05:44 PM.
Old 12-22-2012, 05:43 PM   #2
Registered: Dec 2004
Location: WV, USA
Distribution: Gentoo, Debian
Posts: 186

Original Poster
Rep: Reputation: 34
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).

Last edited by 1veedo; 12-22-2012 at 06:06 PM.
Old 12-23-2012, 02:41 AM   #3
LQ Addict
Registered: Mar 2010
Location: Oakland,Ca
Distribution: wins7, Debian wheezy
Posts: 6,658

Rep: Reputation: 638Reputation: 638Reputation: 638Reputation: 638Reputation: 638Reputation: 638
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


data recovery, fdisk, gparted, partition recovery

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
gparted: error when resizing an SD card partition mzzxx11 Linux - Newbie 3 11-30-2012 12:30 PM
Gparted - external hard disk partitioning error (ntfs) crashhh Linux - Newbie 3 09-26-2010 09:50 AM
Error With GParted : Cannot Create Disk Label adamnew123456 Linux - Hardware 3 10-31-2009 04:15 PM
Error trying to resize NTFS partition with Gparted mistere29 Linux - Newbie 6 06-14-2009 05:20 PM
ntfs partition on usb disk messed up by gparted needs recovery cristiano.fava Linux - Hardware 8 03-09-2009 10:02 AM

All times are GMT -5. The time now is 11:43 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration