it occurs to me, after a night's rest, that if you want short easy-to-remember device names that don't change when drives are reordered etc., then it might work to create 'alias' device nodes. put something into rc.local to look up certain duids (e.g. disklabel <duid> | head -1 ), look up the major/minor numbers of the 'native' device nodes for that disk, then make (or replace) your 'alias' device nodes with the same numbers. sd0a might not always be the sd0a you wanted, but there's no reason that "hd0a" can't be -- it just needs to point to whatever partition your desired sd0a is living on today.
this could probably be done with a shell script and some sed processing, although maybe awk or perl might work better. note that this won't work for things like /etc/fstab unless you do all this work in /etc/rc before the filesystems get mounted (and in that case you need to limit yourself to the tools in /bin and /sbin). exercise left for the reader -- I've had a night's rest but not my morning caffeine. -ken On Sun, Aug 17, 2014 at 3:17 AM, Denis Lapshin <den...@mindall.org> wrote: > I've simply disabled detecting any USB mass storage devices by kernel. > Since then there is no problem with reordering SDx devices and all works > good except usb related storage devices... > > Cheers > > > On 15.08.2014 15:44, Denis Lapshin wrote: > >> May I use DUID in my case when I have a USB card reader which has no >> flash card in it? >> >> How to fix using DUID for SD1 (fstab with SD1 DUIDs is below) as boot >> disk don't mind on any other USB disks, readers (without card, for >> instance) connected to the system during boot? >> >> How to make USB SDx staff working with softraid encrypted HDD which must >> be mounted as SD1 by the kernel (using DUID), but physically determined as >> SD0. >> >> Cheers >> >> On 15.08.2014 13:51, Joel Sing wrote: >> >>> On Fri, 15 Aug 2014, Denis Lapshin wrote: >>> >>>> My fstab has identity for main boot HDD: >>>> >>>> 548ac03903a985e9.a / ffs rw 1 1 >>>> 548ac03903a985e9.g /home ffs rw,nodev,nosuid 1 2 >>>> 548ac03903a985e9.d /tmp ffs rw,nodev,nosuid 1 2 >>>> 548ac03903a985e9.f /usr ffs rw,nodev 1 2 >>>> 548ac03903a985e9.e /var ffs rw,nodev,nosuid 1 2 >>>> 835806792ad105b8.b none swap sw >>>> 127.0.0.1:/home/cvs /var/www/cvs nfs rw,nodev,nosuid 0 0 >>>> >>>> but once I installed usb flash drive and reboot the system, my main boot >>>> HDD stay SD3 instead of SD1 as it should be. >>>> The HDD is encrypted by softraid discipline additionally, so kernel >>>> physically determine it as SD0, softraid mount it as SD1. >>>> >>>> Any additional drive detected by kernel stop booting from main HDD >>>> SD0=SR SD1 because of renaming all SD drives. >>>> >>> Why? >>> >>> What is referencing the sd0/sd1 device directly, rather than using a >>> DUID? >>> >>> In FAQ I found about drives renumeration by kernel: >>>> >>>> "The first drive of a particular type identified by OpenBSD will be >>>> drive '0', the second will be '1', etc. So, the first IDE-like disk will >>>> be wd0, the third SCSI-like disk will be sd2. If you have two SCSI-like >>>> drives and three IDE-like drives on a system, you would have sd0, sd1, >>>> wd0, wd1, and wd2 on that machine. The order is based on the order they >>>> are found during hardware discovery at boot. There are a few key points >>>> to keep in mind: >>>> >>>> * Drives may not be numbered in the same order as your boot ROM >>>> attempts to boot them (i.e., your system may attempt to boot what >>>> OpenBSD identifies as wd2 or sd1). Sometimes you may be able to >>>> change this, sometimes not. >>>> * Removing or adding a disk may impact the identity of other drives >>>> on >>>> the system. >>>> >>>> " >>>> >>>> I would like bind SD labels to drives in invariable fashion. >>>> >>> In short, there is no way to do this - this is what DUIDs are for. >>> >>> On 15.08.2014 11:51, Daniel Jakots wrote: >>>> >>>>> On Fri, 15 Aug 2014 11:37:56 +0400, Denis Lapshin <den...@mindall.org> >>>>> >>>>> wrote: >>>>> >>>>>> Is it possible to change or set fixed device names for drives like >>>>>> SD0, SD1, SD2, SD3 and so on. >>>>>> >>>>> http://www.openbsd.org/faq/faq14.html#DUID >>>>> >>>>> >>>>> Cheers,