Monday Mar 19, 2007

Disk errors, fdisk and format

I had some problems upgrading this laptop to nv60 this weekend. First I managed to try it with the power lead not fully connected so instead of coming back to an upgraded system I came back to a flat battery.

Then the second attempt hung and the only clues were in the messages file:


Mar 18 09:39:09 principia gda: [ID 107833 kern.warning] WARNING: /pci@0,0/pci-ide@1f,1/ide@0/cmdk@0,0 (Disk0):
Mar 18 09:39:09 principia       Error for command 'read sector' Error Level: Fat
al
Mar 18 09:39:09 principia gda: [ID 107833 kern.notice]  Requested Block 62711776
, Error Block: 62711832
Mar 18 09:39:09 principia gda: [ID 107833 kern.notice]  Sense Key: uncorrectable
 data error
Mar 18 09:39:09 principia gda: [ID 107833 kern.notice]  Vendor 'Gen-ATA ' error
 code: 0x7

So I ran up format to see if I could use the analyse option to find the broken block and either repair it or add it to the defect list. So I get the current disk:


format> current
Current Disk = c0d0
<DEFAULT cyl 20031 alt 2 hd 32 sec 63>
/pci@0,0/pci-ide@1f,1/ide@0/cmdk@0,0

format> 

That the geometry is probably made up is not important. With those numbers there are 2016 sectors per cylinder which puts block 62711832 in cylinder 31107 on the disk. Moving so lets plug that into analyse ask it to do 2016 blocks so I test the whole “cylinder” and with luck I can move on. So go into the analyse menu:


analyze> setup
Analyze entire disk[yes]? no
Enter starting block number[0, 0/0/0]: 31107/0/0
`31107' is out of range.
Enter starting block number[0, 0/0/0]: 62711832
`31107/1/57' is out of range.
Enter starting block number[0, 0/0/0]: 

Well that is odd. Now I remember that this system will dual boot, could it be that format is using the Solaris partition and not the whole disk? Looking at the fdsik this would explain it:


             Total disk size is 38760 cylinders
             Cylinder size is 2016 (512 byte) blocks

                                               Cylinders
      Partition   Status    Type          Start   End   Length    %
      =========   ======    ============  =====   ===   ======   ===
          1                 IFS: NTFS         0  8319    8320     21
          2       Active    Solaris        18727  38759    20033     52
          3                 Solaris        8319  18395    10077     26

So the block must be in fdisk partition 2. Subtracting 18727 from 31107 gets me the relative offset in the Solaris partition of 13280 which in turn ends up being in the swap partition, which is the least inconvenient place as I can delete the swap run the analysis, which found nothing, and add the swap back.


I can't help thinking format should not behave like this, or at least have an option to use absolute addresses, perhaps it has and I don't know about it. Anyway roll on EFI.


Tags:

About

This is the old blog of Chris Gerhard. It has mostly moved to http://chrisgerhard.wordpress.com

Search

Archives
« April 2014
MonTueWedThuFriSatSun
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
    
       
Today