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
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>


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

      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.


Thursday Aug 31, 2006

New home server arrived

The new server arrived and like a good geek I stayed up late last night putting it together and loading the Solaris Operating System on it. So far I've not got that far. A base install with mirrored root file system, plus a second boot environment for live upgrade and the rest of the disk(s) are there for real data on ZFS.

Laying out the disks was harder than it should have been due to me wanting to put all the non ZFS bits at the end of the disk not the beginning so that when we have a complete ZFS on root solution I can delete the two root mirrors and allow ZFS to grow over the whole drive. So on the disks the vtoc looks like this:

Part      Tag    Flag     Cylinders         Size            Blocks
  0 unassigned    wm   37368 - 38642        9.77GB    (1275/0/0)   20482875
  1 unassigned    wu       0                0         (0/0/0)             0
  2     backup    wm       0 - 38909      298.07GB    (38910/0/0) 625089150
  3 unassigned    wu       0                0         (0/0/0)             0
  4       root    wu   36093 - 37367        9.77GB    (1275/0/0)   20482875
  5 unassigned    wu   38643 - 38645       23.53MB    (3/0/0)         48195
  6 unassigned    wu   38646 - 38909        2.02GB    (264/0/0)     4241160
  7       home    wm       3 - 36092      276.46GB    (36090/0/0) 579785850
  8       boot    wu       0 -     0        7.84MB    (1/0/0)         16065
  9 alternates    wu       1 -     2       15.69MB    (2/0/0)         32130

Which looks even worse than it really is. On the disk starting at the lowest LBA I have:

  1. The boot blocks on slice 8

  2. Then alternates on slice 9 (format just gives you these for “free”)

  3. The Zpool on slice 7

  4. The second boot environment on slice 4

  5. The first boot environment on slice 0

  6. The metadbs on slice 5

  7. A dump device on slice 6

All the partitions, except the dump device are mirrored onto the other disk so both drives have the same vtoc. As you can see I can grow the zpool over both boot blocks and the metadbs when ZFS on root is completely here.

The next thing to do will be SAMBA.



This is the old blog of Chris Gerhard. It has mostly moved to


« February 2016