hubertf's NetBSD Blog
Send interesting links to hubert at feyrer dot de!
 
[20060813] Wanna try wedges?
When you want to move a disk between different systems, this may not be so easy at all: Even if you use the FFS_EI kernel option for endian independence, the target system is pretty likely to not even see any partitions as their native disk partitioning scheme is different: While NetBSD uses a 'disklabel' internally and even manages to map that onto its native partitions on some systems, on others the firmware may just not recognize the on-disk structure. This happens when you move disks between SPARCs, SGIs, PCs, Amigas, Ataris etc. - they all have their own on-disk schemes, which NetBSD tries to read for the native ports, but doesn't manage to read for 'foreign' disks.

Now this is where 'wedges' come into play: The idea is to have a library of partitioning schemes that allow mapping various systems' formats into a internal disklabel (wedge).

The original idea of this goes back to 1998(!) and was suggested by Charles Hannum. Unfortunately the work was never completed, and Jason Thorpe picked it up in 2004 and mostly completed the work, see his status report. Again some bits were left, and this time it's Christos Zoulas who went to fight the dragon^Wwedge code, and he has some success to report:

``if you want to try wedges on i386/x86_64: 1. cvs update
2. run with the new MAKEDEV in /dev: sh MAKEDEV dk10
3. Add the following to your kernel:
options DKWEDGE_AUTODISCOVER
options DKWEDGE_METHOD_BSDLABEL
options DKWEDGE_METHOD_GPT
options DKWEDGE_METHOD_MBR
4. reboot with the new kernel in single user mode.
5. replace wd/sd in your /etc/fstab with dk
you are all set, you are using wedges.
all your disks are dkN.
'' Here is some example dmesg output:

wd0: Returned 7(7) wedges
wd0: Looking for wd0a in wd0j
wd0: Looking for wd0a in wd0i
wd0: Looking for wd0a in wd0h
wd0: Looking for wd0a in wd0g
wd0: Looking for wd0a in wd0f
wd0: Looking for wd0a in wd0b
wd0: Looking for wd0a in wd0a
wd0: Setting boot wedge dk0 (wd0a) at 61705665 133119
opendisk: can't open dev dk1 (19)
opendisk: can't open dev dk2 (19)
opendisk: can't open dev dk3 (19)
opendisk: can't open dev dk4 (19)
opendisk: can't open dev dk5 (19)
opendisk: can't open dev dk6 (19)
boot device: dk0 (wd0)
root on dk0 
A bit verbose yet, but that'll change. You'll need latest NetBSD-current (i.e. 4.99.something) from today for thist to try (now there's your first "what's new in NetBSD 5.0" item :-). Please post your experiences to current-users@NetBSD.org!

P.S.: A full dmesg is available here. Thanks Christos!

[Tags: , ]



Disclaimer: All opinion expressed here is purely my own. No responsibility is taken for anything.

Access count: 24523979
Copyright (c) Hubert Feyrer