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

Joe Koberg joe at osoft.us
Sun Sep 11 07:43:27 PDT 2005


You might want /usr/ports/sysutils/scan_ffs

from the package description:

  scan_ffs(8) recovers accidential lost or deleted disklabels.
  ...
  This little program will take a raw disk device (which you might have to
  create) that covers the whole disk, and finds all probable UFS/FFS parti-
  tions on the disk.  It has various options to make it go faster, and to
  print out information to help in the reconstruction of the disklabel.

I have used this to rebuild slice/partition tables.
Run scan_ffs on the raw disk. It will find the superblocks and print
the start and length of the each FS from the superblocks. You might
have to offset the numbers based on the start of the old slice as the values
will probably be referenced to raw disk block 0, not the old slice
block 0.


Good luck!

Joe Koberg
joe at osoft dot us




Andreas Klemm wrote:

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



More information about the freebsd-hackers mailing list