Cannot recover partition table in Gparted

Asked by Dr. Kisor Mukhopadhyay

Summary
----------------
Disk /dev/sda: 160.0 GB, 160041885696 bytes (partitions out of order)

   Device Boot Start End Blocks Id System
/dev/sda1 * 1 2878 23117503+ 7 HPFS/NTFS
/dev/sda2 2879 19457 133167457+ f W95 Ext'd (LBA)
   /dev/sda5 2879 5002 17052672 83 Linux
   /dev/sda6 5002 5100 790528 82 Linux swap / Solaris
   /dev/sda3 5101 10200 40965718+ 7 HPFS/NTFS
   /dev/sda7 10201 12601 19285382 7 HPFS/NTFS
   /dev/sda8 12601 15180 20709376 83 Linux
   /dev/sda9 15180 15441 2097152+ 82 Linux swap / Solaris
   /dev/sda10 15442 19457 32258488+ 83 Linux

Original question:
------------------------------
"I reinstalled windows in the windows partition and later reinstalled grub2 as described in Ubuntu mannual (with sudo grub-install /dev/sda8 etc.) Later I found that Gparted does not detect the partition table and shows total HDD unallocated space !! Though I can boot my machine in windows as well as in Ubuntu and Ubuntu shows all the partitions in "Places". Even when I tried to reinstall Ubuntu the partition editor shows no other operating system in my computer and all the space unallocated !! What steps to be taken to get back the partition table ?"

Question information

Language:
English Edit question
Status:
Expired
For:
Ubuntu gparted Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
delance (olivier-delance) said :
#1

Please provide partition table.

If you can't boot from hard drive, boot en Ubuntu CD/USB stik and then choose "Try without install".

Open a terminal: you can either press Ctrl+Alt+T or Applications->Accessories->Terminal.

To copy/paste in a terminal, replace Ctrl+C by Ctrl+Shift+C and Ctrl+V by Ctrl+Shift+V (for historical reason, Ctrl+C is assigned another function).

Paste to terminal the following commands:

    sudo fdisk -l

where "-l" is lower case "L".

Copy/paste result into a new thread post.

Revision history for this message
marcus aurelius (adbiz) said :
#2

i'm assuming you installed ubuntu on a different drive. if this is the case, you need to click the box in the top right corner of gparted which said sda1 (if you have ata drive) and select another drive/partition. otherwise, do what delance suggested.

Revision history for this message
Dr. Kisor Mukhopadhyay (kisor-m) said :
#3

Hi!
Here is my partition table using sudo fdisk -l.

omitting empty partition (5)

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 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: 0x00660066

   Device Boot Start End Blocks Id System
/dev/sda1 * 1 2878 23117503+ 7 HPFS/NTFS
/dev/sda2 2879 19457 133167457+ f W95 Ext'd (LBA)
/dev/sda3 5101 10200 40965718+ 7 HPFS/NTFS
/dev/sda5 2879 5002 17052672 83 Linux
/dev/sda6 5002 5100 790528 82 Linux swap / Solaris
/dev/sda7 10201 12601 19285382 7 HPFS/NTFS
/dev/sda8 12601 15180 20709376 83 Linux
/dev/sda9 15180 15441 2097152+ 82 Linux swap / Solaris
/dev/sda10 15442 19457 32258488+ 83 Linux

I used separate partitions to install ubuntu, not within windows. But I used "Install side by side" options.

Marcus Aurelius's suggestion did not work.

Revision history for this message
Dr. Kisor Mukhopadhyay (kisor-m) said :
#4

Hi!
Here is my partition table using sudo fdisk -l.

omitting empty partition (5)

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 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: 0x00660066

   Device Boot Start End Blocks Id System
/dev/sda1 * 1 2878 23117503+ 7 HPFS/NTFS
/dev/sda2 2879 19457 133167457+ f W95 Ext'd (LBA)
/dev/sda3 5101 10200 40965718+ 7 HPFS/NTFS
/dev/sda5 2879 5002 17052672 83 Linux
/dev/sda6 5002 5100 790528 82 Linux swap / Solaris
/dev/sda7 10201 12601 19285382 7 HPFS/NTFS
/dev/sda8 12601 15180 20709376 83 Linux
/dev/sda9 15180 15441 2097152+ 82 Linux swap / Solaris
/dev/sda10 15442 19457 32258488+ 83 Linux

I used separate partitions to install ubuntu, not within windows. But I used "Install side by side" options.

Marcus Aurelius's suggestion did not work.

Revision history for this message
delance (olivier-delance) said :
#5

You have at least two Linux installed, perhaps three (2 swap, and 3 Linux partitions). And a Windows partition in extended partition. It looks like a mess. Do you have data to recover ? What is sda7 ? I think moving sda7 at start of extended partition, and reinstalling Ubuntu will provide a cleaner situation.

Revision history for this message
Dr. Kisor Mukhopadhyay (kisor-m) said :
#6

What I did actually, I partitioned the unallocated space left for linux using Gparted. There I created swap, /,/home and /boot partitions. Inadvertently during the installation I opted "install side by side" option instead "install using manually partitioning the space". Ubuntu created its own partitions leaving my created partitions aside. Thats why you see two swap partitions etc. Actually there is no other linux in my computer except Ubuntu. SDA7 is a windows partition which was there before installing ubuntu. Later when I reinstalled windows the grub loader deleted and I tried to reinstall it by using the command
sudo mkdir /media/root
sudo mount /dev/sda1 /media/root
sudo grub-install --root-directory=/media/root /dev/sda

Inadvertently I gave sda1 where windows is mounted. Later I corrected the command by giving sda8 where actually linux is installed.
Will it clear my problem ?
How can one move the partition sda7 at start of extended partition ?
Actually I can't see any partition in Gparted !!

Thanks..

Revision history for this message
delance (olivier-delance) said :
#7

I will have a look later. You should raise a bug against Gparted. If fdisk is able to read partition table, Gparted should be able too.

Revision history for this message
delance (olivier-delance) said :
#8

I have found this, but it looks heavy: http://pizzach.blogspot.com/2009/02/moving-ntfs-partition.html
I thought I will be able to do with "parted" but if doesn't list NTFS as a partition he can move.
We can use a trick which sometimes works to fix partition table:
run command
  sudo fdisk
and inside fdisk
  w
which will rewrite partition table. Sometimes, it's enough to fix bugs in partition table and allow Gparted to work.
Could you try and report result.

Revision history for this message
Dr. Kisor Mukhopadhyay (kisor-m) said :
#9

Followed your suggestion, but sudo fdisk gives the following

kisor@kisor-desktop:~$ sudo fdisk
[sudo] password for kisor:

Usage:
 fdisk [options] <disk> change partition table
 fdisk [options] -l <disk> list partition table(s)
 fdisk -s <partition> give partition size(s) in blocks

Options:
 -b <size> sector size (512, 1024, 2048 or 4096)
 -c switch off DOS-compatible mode
 -h print help
 -u <size> give sizes in sectors instead of cylinders
 -v print version
 -C <number> specify the number of cylinders
 -H <number> specify the number of heads
 -S <number> specify the number of sectors per track

later tried with sudo fdisk w
but did't work.
Did I follow the wrong way to go inside fdisk ?

Thanks,

Revision history for this message
Baisakhi Mal (baisakhi-mal) said :
#10

@ kisor
try
sudo fdisk /dev/sda
then there is an option w - which allows you to rewrite the partition table..
but .. i do not know whether that will make it visible in gparted or not ??

Revision history for this message
Dr. Kisor Mukhopadhyay (kisor-m) said :
#11

Oh! yes I tried with sudo /dev/sda then opted w. What happened, I lost grub loader again and had to reinstall grub.The situation is as earlier ... Should I format the whole drive and reinstall windows/Linux again ? Thats a tedious job !
So that failed.....

Thanks

Revision history for this message
Dr. Kisor Mukhopadhyay (kisor-m) said :
#12

Finally I had to format the whole drive and reinstalled windows/ubuntu.... but the way the problem solved is not expected...The source of the problem not detected.
Thanks,...

Revision history for this message
Launchpad Janitor (janitor) said :
#13

This question was expired because it remained in the 'Open' state without activity for the last 15 days.