Location of disklabel

Loren M. Lang lorenl at alzatex.com
Sun Mar 13 03:47:24 PST 2005

On Thu, Mar 10, 2005 at 04:32:30PM -0500, Carl J wrote:
> Hi all! To all your FS guru's outthere, I desperately need
> to know where the disklabel is stored (since my disk is in trouble!)
> Situation:
>   My /dev/ad0s1 has 2 partitions: "a" (FS) followed by "b" (swap).
>   By using "disklabel -r", I see my "a" and "b" indeed
>   take up the entire slice.
> My desperate question:
>   Where, then, is the "disklabel" stored?

The second sector of the slice that the disklabel is partitioning.  For
example, a disklabel on your first slice would be stored in the second
sector of /dev/ad0s1.  The command dd if=/dev/ad0s1 skip=1 | hexdump
will give you a hexdump of the disklabel.  Since the 'a' partition of
the disklabel normally starts at the beginning of the slice that the
disklabel is in, it is identical to reading from the slice directly,
just a little shorter.  Also, the 'c' partition always covers the entire
slice so it is identical assuming the disklabel isn't messed up.

>   Somewhere in the partition table? The Master Boot Record?
>   The reserved cylinder #0?

No, msdos partition table that creates what are called slices in the bsd
world reside in the last few byte of the Master boot record, but this
has nothing to do with the disklabel that is stored in the slice.  And
normally the only thing you will find in cylinder 0 is the master boot
record which is the very first sector of the hard disk.

>   Or is it stored somewhere inside /dev/ad0s1a ??
>   (if that's the case, does that mean the UFS1
>   intentionally left some space unused, for this purpose?
>   And if so, is it always at a fixed location within a UFS1 slice?)

Actually, since the 'a' partition is the same as the beginning of the
slice it's in, the ufs filesystem always skips the first 16 sectors of
whatever partition it's in.

>   What if in my slice, I have SWAP first, and then UFS1,
>   then does that mean the SWAP Format also reserves
>   some unused space for the disklabel to go???
> Sorry if the question is stupid. I just somehow couldn't
> logically see where it would be stored, and yet be compatible
> with having other OS on the same drive... etc.
> Thanks!
> - Carl
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"

I sense much NT in you.
NT leads to Bluescreen.
Bluescreen leads to downtime.
Downtime leads to suffering.
NT is the path to the darkside.
Powerful Unix is.

Public Key: ftp://ftp.tallye.com/pub/lorenl_pubkey.asc
Fingerprint: CEE1 AAE2 F66C 59B5 34CA  C415 6D35 E847 0118 A3D2
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20050313/520115f6/attachment.bin

More information about the freebsd-questions mailing list