Gparted won't read partition table

8,883

Chances are your partition table is damaged, or possibly just a little bit odd. GParted tends to show disks with such partition tables as being completely empty (with no partitions), which is unhelpful.

The solution is to fix the partition table. Unfortunately, it's unclear from your post exactly what's wrong with the partition table. Posting the output of sudo fdisk -l /dev/sda and of sudo parted /dev/sda print might give some clues about what's wrong.

You could also try running my FixParts on the disk, although it's probably better to try to figure out what's wrong first. FixParts can fix a number of common problems, but if used inappropriately it could conceivably cause more damage -- hence my recommendation to post your partition data here first. (You can add this information by editing your post. Be sure to add four spaces to the start of each line of program output; this is a flag to the forum software to preserve the formatting.) Please add a comment to this answer if you add this information; that way I'll notice and check back.


EDIT: Your problem is that your disk is 488,397,168 sectors long, but your extended partition extends out to sector 488,408,129. Fortunately, the logical partition within the extended partition is of legal size. This is one of the problems that FixParts can fix, so try using it. Be sure to read its documentation first. The solution is fairly simple, but you have to know at least the basics of how to use the program; it won't guide you by the hand through the process.

Share:
8,883

Related videos on Youtube

ThisIsNotAnId
Author by

ThisIsNotAnId

There is a great how-to-ism all over the world, and every person, particularly the modern contemporary mind, has become a how-to-er: how to do this, how to do that, how to grow rich, how to be successful, how to influence people and win friends, how to meditate, even how to love. The day is not far off when some stupid guy is going to ask how to breathe. It is not a question of how at all. Don't reduce life into technology. Life reduced into technology loses all flavor of joy. - OSHO Sometimes I wish I can be as savage as Mai from Nichijou. She is the most low-key savage person I have ever come across in my life. When I'm working, my computer slows down sometimes and I think to myself why is 6GB of RAM not enough? Why? One of the most valuable things life has done for me is it has freed me of everything. All of my fears, all of my concerns, all of my questions and answers. Everything is gone. Now I am alone. And for that I cannot thank life enough.

Updated on September 18, 2022

Comments

  • ThisIsNotAnId
    ThisIsNotAnId almost 2 years

    I just recently removed two Linux operating systems (mint and ubuntu) from my computer, which also contains a windows vista installation. I removed both with the "OSremover" found on boot-repair-disk's live image.

    Before removing Ubuntu I forgot that I had encrypted the home directory. The removal worked just fine, and now I can boot into windows as usual.

    However, now that I'm trying to install a new Linux OS, I can see that gparted doesn't recognize any partitions on my disk and it says that all of the space there is unallocated. I checked with the disk management service on windows and it can see all my partitions just fine, even the ones I previously used for the two Linux installations (which I've deleted and merged with my windows partition).

    I have no idea what's going on, I've tried fixing the mbr with bootrec /fixmbr but that didn't do anything. Also, running fdisk -l from a live image of elementary-os lists my partitions as they should be.

    I'm adding outputs from the from the sudo fdisk -l /dev/sda and /sudo parted /dev/sda print commands as per Rod Smith's suggestion. First, fdisk:

    Disk /dev/sda: 250.1 GB, 250059350016 bytes
    255 heads, 63 sectors/track, 30401 cylinders, total 488397168 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: 0xcab10bee
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1   *          63   484458486   242229212    7  HPFS/NTFS/exFAT
    /dev/sda2       484472205   488408129     1967962+   f  W95 Ext'd (LBA)
    /dev/sda5       486434816   488396783      980984   82  Linux swap / Solaris
    

    Now, parted:

    Error: Can't have a partition outside the disk!           
    

    Hope this helps.

    Solution:

    Ran fixparts and it automatically fixed the error on execution, just had to save the new table with the w command.

    Concern:

    Received the following message:

    Warning: 0xEE partition doesn't start on sector 1. This can cause problems
    in some OSes.
    
    • oldfred
      oldfred over 9 years
      Gparted fails if NTFS has issues. If chkdsk flag or hibernation flag is set then it will not work. And if you resized NTFS from outside Windows or have not rebooted then the NTFS partition(s) need chkdsk. Make sure hibernation is off.
    • ThisIsNotAnId
      ThisIsNotAnId over 9 years
      @oldfred I tried using powercfg.exe /hibernate off but it looks like it's already been disabled.
    • oldfred
      oldfred over 9 years
      Testdisk has been known to do this due to bad rounding. Your extended partition ends after the end of the drive or 488408129 which is greater than drive's 488397168 sectors. First backup current partition table. sudo sfdisk -d /dev/sda > parts_sda.txt and save to another device. I think Rod's suggestion of fixparts may work or just using fdisk and writing table. Since it is "only" the extended partition your data should be ok, but good backups always required.
    • Rod Smith
      Rod Smith over 9 years
      I don't think fdisk will automatically resize the extended partition -- at least, it didn't the last time I looked at this. It could be fixed with fdisk, but you'd need to delete both the logical and extended partitions and then re-create them, which is a little dangerous. FixParts will do this much more simply, with less room for user error.
  • ThisIsNotAnId
    ThisIsNotAnId over 9 years
    This is what I'm avoiding. I'm hoping there might be another way to recover the partition table, maybe with parted but i'm not sure how to work with that.
  • Rod Smith
    Rod Smith over 9 years
    This advice will destroy the partition table! Since that disk contains a working Windows installation, which ThisIsNotAnId presumably wants to keep, destroying the partition table is the last thing to recommend!
  • ThisIsNotAnId
    ThisIsNotAnId over 9 years
    Hi Rod, thank you for the suggestions. I've added the outputs to my post now.
  • Rod Smith
    Rod Smith over 9 years
    Please see my edit.
  • ThisIsNotAnId
    ThisIsNotAnId over 9 years
    Your program worked! It did the job and now I can see my partitions in Gparted. Although now I see an extra unallocated partition in Gparted which doesn't show up with fdisk and maybe even Windows (not sure though), and I also received the "Warning: 0xEE partition doesn't start on sector 1. This can cause problems in some OSes." message. But otherwise, everything seems to be in order. Thanks!
  • Rod Smith
    Rod Smith over 9 years
    There's no such thing as an "unallocated partition;" by definition, a partition is allocated disk space. Unfortunately, some GUIs make unallocated disk space look like partitions, so a lot of people get confused by this. There were gaps even in the partition table you showed, so seeing unallocated space is not surprising. The message about the 0xEE partition is a bug in GPT fdisk (and therefore FixParts) version 0.8.8. Ubuntu 15.04 (currently in beta) ships with 0.8.10, and 1.0.0 (or possibly something later) will be in 15.10. Both versions fix that bug.