[ltp] Partition table seems corrupted

jcms linux-thinkpad@linux-thinkpad.org
Sun, 26 Dec 2004 09:46:32 -0500 (GMT-05:00)


   Dear Mr. Keitel,
  
   I tried to change the number of cylinders to the correct one with fdisk, i.e., 93015.
   Here is what I did:

----------------------------------------------------------------------------------------------------------------------------------------------------------   
# fdisk /dev/hdb
Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

Command (m for help): x
                                                                                                                                  
Expert command (m for help): m
Command action
   b   move beginning of data in a partition
   c   change number of cylinders
   d   print the raw data in the partition table
   e   list extended partitions
   f   fix partition order
   g   create an IRIX (SGI) partition table
   h   change number of heads
   m   print this menu
   p   print the partition table
   q   quit without saving changes
   r   return to main menu
   s   change number of sectors/track
   v   verify the partition table
   w   write table to disk and exit


   Expert command (m for help): c
Number of cylinders (1-1048576, default 6201): 93015
                                                                                                                                  
The number of cylinders for this disk is set to 93015.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)
                                                                                                                                  
Expert command (m for help): r
                                                                                                                                  
Command (m for help): w
The partition table has been altered!
 
Calling ioctl() to re-read partition table.
Syncing disks.

----------------------------------------------------------------------------------------------------------------------------------------------------------

After that fdisk still reports 6201 cylinders. Any ideas ?

   J.C.


-----Original Message-----
From: Tino Keitel <tino.keitel@gmx.de>
Sent: Dec 24, 2004 3:43 PM
To: linux-thinkpad@linux-thinkpad.org
Subject: Re: [ltp] Partition table seems corrupted

On Fri, Dec 24, 2004 at 11:17:18 -0500, jcms wrote:

[...]

> Here is the output of "sfdisk -l /dev/hdb":
> 
> Disk /dev/hdb: 93015 cylinders, 16 heads, 63 sectors/track
> Warning: The partition table looks like it was made
>   for C/H/S=*/240/63 (instead of 93015/16/63).

IMHO this is the reason for your problem. Something set a strage
geometry with only 16 heads instead of 240, which results in a very
high cylinder number (93015) which can not be handled by the BIOS and
maybe some disk partitioning tools.

As you can see, sfdisk is clever enough to use the correct geometry,
but I think the BIOS isnt.

> For this listing I'll assume that geometry.
> Units = cylinders of 7741440 bytes, blocks of 1024 bytes, counting from 0
>                                                                                                                                               
>    Device Boot Start     End   #cyls    #blocks   Id  System
> /dev/hdb1          0+    128     129-    975208+  82  Linux swap / Solaris
> /dev/hdb2   *    129    1932    1804   13638240   83  Linux
> /dev/hdb3       1933    3100    1168    8830080    f  W95 Ext'd (LBA)
> /dev/hdb4       3101    3655     555    4195800   83  Linux
> /dev/hdb5       1933+   2210     278-   2101648+  83  Linux
> /dev/hdb6       2211+   2280      70-    529168+  83  Linux
> /dev/hdb7       2281+   3100     820-   6199168+  83  Linux
> 
> The partitions seem to be still there but I still cannot mount
> /dev/hdb2, /dev/hdb5 & /dev/hdb7.
> 
> ---------------------------------------------------------------------------------------------------
> 
>    This is what I copied from running yast2:
> 
>                            Start Cylinder   End Cylinder
> /dev/hdb                                0          93014 
> /dev/hdb1   0x82 Swap                   0           1934 
> /dev/hdb2   0x83 Linux Native        1935          28994
> /dev/hdb3        Extended           28995          46514
> /dev/hdb5   0x83                    28995          33164
> /dev/hdb6   0x83                    33165          34214
> /dev/hdb7   0x83                    34214          46514
> /dev/hdb4   0x83                    46515          54839 
> 
> ---------------------------------------------------------------------------------------------------
> 
>    I have tried testdisk from ttp://www.cgsecurity.org/index.html and it shows that the partitions have been deleted. 
>    I did not try to fix it using it ( I'm still a little confused about what partition type to set for each one of them ).
> 
> ---------------------------------------------------------------------------------------------------
> 
>    How can I re-write the partition and not loose the data on the old drive ? May be fdisk and if yes how ? Please, be explicity as much as possible, I don't have a backup of the files not transfered to the new disk.

This sould work with fdisk.

Regards,
Tino
-- 
The linux-thinkpad mailing list home page is at:
http://mailman.linux-thinkpad.org/mailman/listinfo/linux-thinkpad