disklabel in raw and kernel mode disagree

Matthew Dillon dillon at apollo.backplane.com
Thu May 31 10:59:26 PDT 2007


:on a usb stick:
:
:disklabel -r -e yields one c: partition starting at offset 63.  using thi=
:s disklabel unmodified produces complaints from disklabel itself:
:
:partition c: partition extends past end of unit
:Warning, partition c doesn't start at 0!
:
:doing the same without -r produces the right offset (0).
:
:cheers
:  simon

    On what device?  If you do it on the raw device (e.g. /dev/da0) there
    won't be any label snooping.  Labels only get snooped on slice devices,
    which is why we really only support labeling slice devices.  You might
    be able to get away with specifying e.g. /dev/da0s0 though.

    The on-disk version of the disklabel is different from the in-memory
    version.  This is historical, inherited from FreeBSD (and even before
    that I think)... and I wish now that I had removed it years ago but
    too late now...  all the offsets in the on-disk label are absolute,
    i.e. adjusted to add in the slice offset.

    When the kernel read-snoops the on-disk label it adjusts the offsets
    back to 0.  When the kernel write-snoops it adjusts the offsets back
    to absolute.

    What I would like to do is just read and write the label straight,
    without snoop-adjusting it.  The kernel NEVER uses the absolute offsets,
    it always uses the slice-relative offsets (i.e. starting at 0).

						-Matt






More information about the Bugs mailing list