[patch] NetBSD disklabel support for geom_bsd
Dmitry Pryanishnikov
dmitry at atlantis.dp.ua
Sat Mar 18 01:48:14 UTC 2006
Hello!
On Fri, 17 Mar 2006, Jos Backus wrote:
>> My patch modifies disklabel only for NetBSD partition (type 169),
>> and only in memory, not on disk. So it definitely won't affect
>> moving any partition using a non-FreeBSD aware tools.
>
> Thanks for clarifying that. I guess I phrased this poorly. I meant to say that
> if FreeBSD were to move to the NetBSD model, that would seem to be one of the
> downsides as it must be for NetBSD today. When moving a NetBSD partition, the
> label needs to be updated whereas with a FreeBSD partition it does not.
Well, as I wrote in my previuos letter, it's my mistake that FreeBSD
uses slice-relative offsets while NetBSD uses absolute offsets. Actually,
both systems use absolute offsets, and offset conversion isn't required
(but just accidently happens harmless).
Actually, I can tell what has created my confusion. Did anyone analyze
how disklabel offsets look under RELENG_4? It's very interesting:
# fdisk ad4
******* Working on device /dev/ad4 *******
parameters extracted from in-core disklabel are:
cylinders=788 heads=255 sectors/track=63 (16065 blks/cyl)
parameters to be used for BIOS calculations are:
cylinders=788 heads=255 sectors/track=63 (16065 blks/cyl)
Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 165,(FreeBSD/NetBSD/386BSD)
start 63, size 10474317 (5114 Meg), flag 0
beg: cyl 0/ head 1/ sector 1;
end: cyl 651/ head 254/ sector 63
The data for partition 2 is:
sysid 165,(FreeBSD/NetBSD/386BSD)
start 10474380, size 2184840 (1066 Meg), flag 80 (active)
beg: cyl 652/ head 0/ sector 1;
end: cyl 787/ head 254/ sector 63
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>
So 1st slice starts at usual offset 63.
# dd bs=512 if=/dev/ad4s1 iseek=1 | hd | more
00000000 57 45 56 82 05 00 00 00 61 64 34 73 31 00 00 00 |WEV.....ad4s1...|
00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000020 00 00 00 00 00 00 00 00 00 02 00 00 3f 00 00 00 |............?...|
00000030 ff 00 00 00 8b 02 00 00 c1 3e 00 00 4d d3 9f 00 |.........>..M...|
00000040 00 00 00 00 00 00 00 00 10 0e 01 00 00 00 00 00 |................|
00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00000080 00 00 00 00 57 45 56 82 31 f4 08 00 00 20 00 00 |....WEV.1.... ..|
00000090 00 20 00 00 00 00 08 00 00 00 00 00 00 00 00 00 |. ..............|
000000a0 07 00 00 00 00 00 10 00 00 00 08 00 00 00 00 00 |................|
000000b0 01 00 00 00 4d d3 9f 00 00 00 00 00 00 00 00 00 |....M...........|
000000c0 00 00 00 00 4d d3 87 00 00 00 18 00 00 00 00 00 |....M...........|
Partition table starts at offset 0x94, and media offset (starting sector)
goes at offset 4 in every entry. As you can see, offset of 'a' partition
is zero (bytes 98-9b of dump). So here it IS slice-relative.
But now dump this sector using base unit (ad4) entry instead of slice (ad4s1):
# dd bs=512 if=/dev/ad4 iseek=64 | hd | more
00000000 57 45 56 82 05 00 00 00 61 64 34 73 31 00 00 00 |WEV.....ad4s1...|
00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000020 00 00 00 00 00 00 00 00 00 02 00 00 3f 00 00 00 |............?...|
00000030 ff 00 00 00 14 03 00 00 c1 3e 00 00 c2 5d c1 00 |.........>...]..|
00000040 00 00 00 00 00 00 00 00 10 0e 01 00 00 00 00 00 |................|
00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00000080 00 00 00 00 57 45 56 82 7f 7b 08 00 00 20 00 00 |....WEV..{... ..|
00000090 00 20 00 00 00 00 08 00 3f 00 00 00 00 00 00 00 |. ......?.......|
000000a0 07 00 00 00 00 00 10 00 3f 00 08 00 00 00 00 00 |........?.......|
000000b0 01 00 00 00 4d d3 9f 00 3f 00 00 00 00 00 00 00 |....M...?.......|
000000c0 00 00 00 00 4d d3 87 00 3f 00 18 00 00 00 00 00 |....M...?.......|
As you can see, now offsets are absolute. This behaviour (label
auto-conversion "on the fly") has created so much confusion for me.
There is no such conversion in modern (e.g., RELENG_6) FreeBSD, I just see
absolute labels in both cases (and I like it).
Sincerely, Dmitry
--
Atlantis ISP, System Administrator
e-mail: dmitry at atlantis.dp.ua
nic-hdl: LYNX-RIPE
More information about the freebsd-current
mailing list