need hints to recover lost FreeBSD partition entries in MBR ...

Andreas Klemm andreas at klemm.apsfilter.org
Sun Sep 11 03:34:28 PDT 2005


I unluckily lost the partition table of my 1st disc in a 2 disc system.
Tip: avoid gag boot manager and don't do my mistakes ...

Having a printout of the df command I was able to re-create all of
my fat32 partitions on disc XP boot and 4x FAT32 in an extended part.

Now I'm looking for suggestions how to be able to compute the
correct values for Slice 3 and 4 which I could not recover so far.

It irritates me a bit, that the slices 1+2 already work so well,
so theoretically mounting of at least slice 3 should be possible now.

Or are there some sanity checks in the kernel that only allows
creating the devices in devfs if the size entries in the disklabel
and the entry in the partition table of the MBR fit both ??

Maybe I'm only off-by 1 or 2 cylinders in the partition table.

Do you know a tool or a method how I can compute/find the start cylinder
of FreeBSD partitions ?

Perhaps Im already at the right start cylinder and now only have
to de-chiffre the entries of the BSD disklabel, which should be
in the 1st sector of sector 312581808 ???

This I was able to restore, which works well.

Disk name:      ad4                                    FDISK Partition Editor
DISK Geometry:  19457 cyls/255 heads/63 sectors = 312576705 sectors (152625MB)

Offset       Size(ST)        End     Name  PType       Desc  Subtype    Flags

         0         63         62        -     12     unused        0
        63   24579387   24579449    ad4s1      7        fat       11
  24579450  174080340  198659789    ad4s2      4 extended DOS        5
 198659790  113922018  312581807        -     12     unused        0

I only had this data available to compute the rest...

Filesystem        1k-blocks     Used    Avail Capacity  Mounted on
/dev/ad4s3d         8119448        4  7469890       0%  /test
/dev/ad4s4d        46026106 24134198 18209820      57%  /data

This resulted in that partitioning, which unluckily doesnt work.

Disk name:      ad4                                    FDISK Partition Editor
DISK Geometry:  19457 cyls/255 heads/63 sectors = 312576705 sectors (152625MB)

Offset       Size(ST)        End     Name  PType       Desc  Subtype    Flags

         0         63         62        -     12     unused        0
        63   24579387   24579449    ad4s1      7        fat       11
  24579450  174080340  198659789    ad4s2      4 extended DOS        5
 198659790   17077095  215736884    ad4s3      8    freebsd      165
 215736885   96839820  312576704    ad4s4      8    freebsd      165
 312576705       5103  312581807        -     12     unused        0

In devfs I only see the devices
rw-r-----  1 root  operator    4,  17 11 Sep 09:56 ad4s3
crw-r-----  1 root  operator    4,  27 11 Sep 09:56 ad4s3c
crw-r-----  1 root  operator    4,  18 11 Sep 09:56 ad4s4
crw-r-----  1 root  operator    4,  28 11 Sep 09:56 ad4s4c

But not ad4s3d and ad4s4d which would indicate I got the 
partition table entries for Slice 3+4 right.


	Andreas ///

-- 
Andreas Klemm - Powered by FreeBSD 5.4
Need a magic printfilter today ? -> http://www.apsfilter.org/


More information about the freebsd-hackers mailing list