On Tue, Sep 04, 2018 at 03:04:15PM +0000, Jiri B. wrote:
> Hi,
>
> I have couple of softraid devices available in a box and when I do upgrade
> I always have to check and not to make mistake which softraid device
> I want to use as root disk.
FWIW, the upgrade won't proceed until you pick a disk that has something
like a root file system on it. There is a fair chance that you can find
the proper disk by just pressing enter a number of times, unless you
have multiple root filesystems (as I assume could be the case with
diskless setups).
See is_rootdisk() in /usr/src/distrib/miniroot/install.sub:
$ sed '/^is_rootdisk/,/^}$/!d' /usr/src/distrib/miniroot/install.sub
is_rootdisk() {
local _d=$1 _rc=1
(
make_dev $_d
if disklabel $_d | grep -q '^ a: .*4\.2BSD ' &&
mount -t ffs -r /dev/${_d}a /mnt; then
ls -d /mnt/{bin,dev,etc,home,mnt,root,sbin,tmp,usr,var}
_rc=$?
umount -f /mnt
fi
rm -f /dev/{r,}$_d?
return $_rc
) >/dev/null 2>&1
}
/Alexander
> If OpenBSD would have serial for softraid device I would just need to remember
> the serial for my root disk.
>
> This is similar output what install.sub's diskinfo() returns in installer:
>
> # bioctl softraid0 | awk '$NF == "RAID1" { cmd=sprintf("bioctl -q
> %s",$(NF-1)); system(cmd); }'
> sd5: <OPENBSD, SR RAID 1, 006>, serial (unknown)
> sd6: <OPENBSD, SR RAID 1, 006>, serial (unknown)
> sd7: <OPENBSD, SR RAID 1, 006>, serial (unknown)
> sd8: <OPENBSD, SR RAID 1, 006>, serial (unknown)
> sd9: <OPENBSD, SR RAID 1, 006>, serial (unknown)
>
> Is it because bd_serial is not implemented for softraid devices?
>
> $ ag bd_serial /usr/src/sys/
> /usr/src/sys/dev/ic/ami.c
> 2037: strlcpy(bd->bd_serial, ser, sizeof(bd->bd_serial));
> 2268: bzero(&bd->bd_serial, sizeof(bd->bd_serial));
> 2287: strlcpy(bd->bd_serial, ser,
> 2288: sizeof(bd->bd_serial));
>
> /usr/src/sys/dev/ic/ciss.c
> 1068: bd->bd_serial[0] = '\0';
> 1090: strlcpy(bd->bd_serial, pdid->serial,
> 1091: sizeof(bd->bd_serial));
>
> /usr/src/sys/dev/ic/mpi.c
> 3386: /* bd_serial[32]; */
>
> /usr/src/sys/dev/pci/arc.c
> 2256: strlcpy(bd->bd_serial, serial, sizeof(bd->bd_serial));
>
> /usr/src/sys/dev/pci/mpii.c
> 3596: scsi_strvis(bd->bd_serial, ppg->serial, sizeof(ppg->serial));
>
> /usr/src/sys/dev/biovar.h
> 111: char bd_serial[32]; /* serial number */
>
> Jiri
>