1

Topic: gparted says unallocated, when not so ..

First, something went wrong when I tried to reformat one partition using gparted - error, and laptop wouldn't boot, etc.  So I booted into systemrescuecd and ran testdisk until all partitions were green and "p" listed files correctly.  Wrote out the partition table.  Fdisk -l lists partitions Ok, but the thing wouldn't boot until I did an fdisk /dev/sda, p, and w.  Then I reinstalled grub using systemrescuecd chroot solution, and it worked.

So I now boot into my favourite linux partion Ok, although I messed up one partition by fsck'ing it when it really was ntfs.

=> But the remaining problem is, both on systemrescuecd and mint linux, running gparted says there are no partitions!  It only shows *unallocated space*.  fdisk -l also does not work on mint linux, although it's fine on systemrescuecd.

I wonder whether anyone knows this symptom/has a solution?  Thanks.

2

Re: gparted says unallocated, when not so ..

It sounds as if there is a problem with the partition table.

Would you be able to provide the output from the following two commands?

fdisk -l -u

where one of the options is a lower case "L" and not the number one.

parted /path-to-your-device unit s print

where /path-to-your-device is something like /dev/sda.

3

Re: gparted says unallocated, when not so ..

gedakc wrote:

It sounds as if there is a problem with the partition table.

Would you be able to provide the output from the following two commands?

fdisk -l -u

where one of the options is a lower case "L" and not the number one.

parted /path-to-your-device unit s print

where /path-to-your-device is something like /dev/sda.

Ok.  Here is fdisk:

root@sysresccd /root # fdisk -l -u

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

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *          63       80321       40129+   6  FAT16
Partition 1 does not end on cylinder boundary.
/dev/sda2           80325   102478621    51199148+   7  HPFS/NTFS
/dev/sda3       102478635   122945435    10233400+   7  HPFS/NTFS
/dev/sda4       122945445   976784129   426919342+   f  W95 Ext'd (LBA)
/dev/sda5       122945508   131347419     4200956   82  Linux swap / Solaris
/dev/sda6       131347503   172313182    20482840   83  Linux
/dev/sda7       172313253   213278932    20482840   83  Linux
/dev/sda8       213279003   254244682    20482840   83  Linux
/dev/sda9       254244753   315677248    30716248   83  Linux
/dev/sda10      315677313   356642999    20482843+   7  HPFS/NTFS
/dev/sda11      356643063   397608742    20482840   83  Linux
/dev/sda12      397608813   540958719    71674953+   7  HPFS/NTFS
/dev/sda13      540962816   976766975   217902080   83  Linux

Disk /dev/sdb: 2021 MB, 2021654016 bytes
201 heads, 18 sectors/track, 1091 cylinders, total 3948543 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0005d56c

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1     3948542     1974271   83  Linux

The sdb1 represents my USB systemrescuecd, of course.

Now, parted /dev/xxx unit s print:

root@sysresccd /root # parted /dev/sda unit s print
Error: Can't have a partition outside the disk!     

I would guess the last is important, but means naught to me!

Thanks -jae

4

Re: gparted says unallocated, when not so ..

From the fdisk and parted output I can certainly see the problem.

976,773,168 total sectors on disk /dev/sda
976,784,129 end sector of extended partition /dev/sda4

Unfortunately the libparted library (used by both parted and gparted) is unable to work with an invalid partition table.

To fix the partition table involves either manual editing using fdisk, or else trying testdisk.  I would highly recommend that you back up all of your data before attempting to edit your partition table.

5

Re: gparted says unallocated, when not so ..

gedakc wrote:

From the fdisk and parted output I can certainly see the problem.

976,773,168 total sectors on disk /dev/sda
976,784,129 end sector of extended partition /dev/sda4

Unfortunately the libparted library (used by both parted and gparted) is unable to work with an invalid partition table.

To fix the partition table involves either manual editing using fdisk, or else trying testdisk.  I would highly recommend that you back up all of your data before attempting to edit your partition table.

Unfortunately I can't back up my data (all my DVD+RW seem not to work), but could you give an example for fdisk or testdisk?  I've used both to look at the disk & partitions but have never tried to edit ..  I'd be most grateful.

Thanks, -jae

6

Re: gparted says unallocated, when not so ..

You might first print out your current partition table with a command like "fdisk -l -u".  Next try using testdisk to scan your drive and it will prompt you with a possible partition layout.  If it matches your current partition table (except for the too big extended partition), then accept the solution from testdisk.

7

Re: gparted says unallocated, when not so ..

gedakc wrote:

You might first print out your current partition table with a command like "fdisk -l -u".  Next try using testdisk to scan your drive and it will prompt you with a possible partition layout.  If it matches your current partition table (except for the too big extended partition), then accept the solution from testdisk.

Actually it turned out I lied w.r.t. backup.  I rsync'd everything to another computer, including a month-old copy of the ntfs partition I ruined.  However I already tried testdisk several times and made all the partitions green, wrote out the partition table and nothing worked or even booted.  Things *did* boot after I used fdisk to write out the partition table, but only Linux, not Windows, and with one ruined partition.  This is where this thread began.

The current fdisk -l -u shows a mismatch of total sectors and the end sector of the extended partition.  Since I've backed up everything (including an image of the ruined ntfs partition), I'm ready to resize with fdisk, I think ..

either the last partition?  Or the extended partition?

8

Re: gparted says unallocated, when not so ..

The last partition (sda13) looks okay to me since it ends before the physical end of the hard drive.

It is unfortunate that testdisk was unable to fix the problem because this would have been the easiest option.

Instead, it looks like you will need to resort to fdisk to manually delete the extended partition (and possibly all of the logical partitions first), and then recreate each one in numerical order.  Since fdisk only edits the partition table, the data within the file systems should be okay as long as you recreate the partitions with the exact same sector locations and numerical order.

9

Re: gparted says unallocated, when not so ..

gedakc wrote:

The last partition (sda13) looks okay to me since it ends before the physical end of the hard drive.

It is unfortunate that testdisk was unable to fix the problem because this would have been the easiest option.

Instead, it looks like you will need to resort to fdisk to manually delete the extended partition (and possibly all of the logical partitions first), and then recreate each one in numerical order.  Since fdisk only edits the partition table, the data within the file systems should be okay as long as you recreate the partitions with the exact same sector locations and numerical order.

What I thought.  Wuff.  Here goes nothing.  I shall do it slowly, and scream like a banshee if I f@#$ up.  Thank you very much.  I'll report on the result afterwards.

10

Re: gparted says unallocated, when not so ..

Well, it took a few "fdisk /dev/sda" runs.  Anyone following this thread should know fdisk must be obeyed (accepted as many defaults as I could) and, I had to make all my logical partitions following the extended partition smaller, so that the start of all partitions coincided.  But - YAY!  All partitions back 100%, fixed, lovely.  Bob's your uncle.  Piece of cake.  %^)  Windows, Linuxes, busted NTFS (W7 fixed it), everything.  On the other hand, I can't see how one changes the topic to say "SOLVED" ..

11

Re: gparted says unallocated, when not so ..

'Glad to hear that you were able to resolve the problem.  smile

To mark a thread as SOLVED, simply edit the initial post and prefix "SOLVED" in front of the title.