On 15 March 2015 at 23:38, Theo de Raadt <dera...@cvs.openbsd.org> wrote: >> The only thing I'd like to have is a command or easy way >> to convert a duid to a /dev/sd0a name to use current - or future - >> utilities that don't support DUID like badblocks from e2fsprogs >> in ports... > > In disklabel, you can see the duid for a drive; > > disklabel sd0 | grep duid > > Alternatively, sysctl knows them too > > sysctl hw.disknames > > There are circumstances where a disk can lack a duid, because > they have no way to store the information. But these are rare, > and not typical storage.
For those faced with onerous task of manually changing a duid infested fstab to the equivalent non-DUID one I present the (not quite complete, but it's off the top of my head) script. Sorry 'bout the gmail de-indentation. Needs some more sed magic to put /dev/sdNn rather than sdN.n in the fstab lines generated. I'm sure true script mages (I name no names) could make it much more elegant. Perhaps this will alleviate some of the panic engendered by suddenly facing a duid fstab. :-) I leave the changes to do the reverse process as an exercise for the reader. No fair looking at the install script source. .... Ken #!/bin/ksh # De-DUID an fstab. OIFS=$IFS IFS=, set -- $(sysctl -n hw.disknames) IFS=$OIFS cp /etc/fstab /tmp/fstab entries=$* for _entry in $entries; do OIFS=$IFS IFS=":" set -- $_entry if [[ -n $2 ]]; then echo "$1 has a DUID of $2" sed -e "/$2/s//$1/p" /tmp/fstab >/tmp/fstab.new cp /tmp/fstab.new /tmp/fstab fi IFS=$OIFS done #cp /tmp/fstab /etc/fstab