Hi Jean-Philippe,
Jean-Philippe Ouellet wrote on Wed, Nov 26, 2014 at 03:05:27AM -0500:
> Finally found some free time.
>
> What would you think of making the "Which disk is the root disk?"
> question default to the first softraid device you have configured,
> if any.
I don't like that.
> The thinking is if you bothered to actually configure a softraid
> device, it's probably because you actually intend to use it, right?
But not necessarily for the root partition.
Granted, i'm using such a setup with even root on RAID on a few
machines right now, but only because some co-admins were very
strongly in favour of it, and my own inclination to avoid it
was not *that* strong.
On machines where i make the decision alone, i still keep the
operating system (root, usr, ...) and transient data (tmp, usr/obj,
var on non-server machines, ...) off RAID and only RAID user data
(home, usr/src on dev machines, var/www on webservers, ...).
Nick has explained many times what the advantages are, and why "just
RAID everything" is often indicative of a false sense of security
(or reliability, depending on the scenario), so i still think root
off RAID is the recommended way unless you have special needs.
I think the installer defaults should agree with what we recommend.
Yours,
Ingo
> Whenever I use softraid (either for crypto, or actual raid) it's
> always held my / ever since booting from it has been supported.
> I suspect this may be the case for others as wells.
>
> If you think this describes the majority of softraid users, then
> I propose the following:
>
>
> Index: install.sub
> ===================================================================
> RCS file: /cvs/src/distrib/miniroot/install.sub,v
> retrieving revision 1.799
> diff -u -p -r1.799 install.sub
> --- install.sub 18 Nov 2014 19:00:16 -0000 1.799
> +++ install.sub 25 Nov 2014 14:05:15 -0000
> @@ -149,15 +149,23 @@ scan_dmesg() {
>
> scan_disknames() {
> local IFS=,
> - bsort $(for _n in $(sysctl -n hw.disknames); do echo "${_n%%:*} "; done
> | sed -n "$1")
> + bsort $(for _n in $(sysctl -n hw.disknames); do echo "${_n%%:*} "; done)
> }
>
> -get_dkdevs () {
> - echo $(scan_disknames "${MDDKDEVS:-/^[sw]d[0-9][0-9]* /s/ .*//p}")
> +filter_dkdevs() {
> + sed -n "${MDDKDEVS:-/^[sw]d[0-9][0-9]* /s/ .*//p}"
> }
>
> -get_cddevs () {
> - echo $(scan_disknames "${MDCDDEVS:-/^cd[0-9][0-9]* /s/ .*//p}")
> +filter_cddevs() {
> + sed -n "${MDCDDEVS:-/^cd[0-9][0-9]* /s/ .*//p}"
> +}
> +
> +get_dkdevs() {
> + echo $(scan_disknames | filter_dkdevs)
> +}
> +
> +get_cddevs() {
> + echo $(scan_disknames | filter_cddevs)
> }
>
> get_ifdevs() {
> @@ -166,6 +174,13 @@ get_ifdevs() {
> sed -n 's/^\(.*\):.*/\1/p'
> }
>
> +guess_rootdev() {
> + local _raid _dev
> + _raid=$(bioctl -i softraid0 2>/dev/null | grep ^softraid)
> + _dev=$(for _n in $_raid; do echo "$_n "; done | filter_dkdevs | sed 1q)
> + [ -n "$_dev" ] && echo "$_dev" || get_dkdevs | sed 's/ .*//'
> +}
> +
> get_drive() {
> ask_which "$1" "contains the $MODE media" "$2" "$3"
> [[ $resp == done ]] && return 1
> @@ -2249,7 +2264,7 @@ diskinfo() {
> while :; do
> echo "Available disks are: $(get_dkdevs | sed 's/^$/none/')."
> _ask "Which disk is the root disk? ('?' for details)" \
> - $(get_dkdevs | sed 's/ .*//') || continue
> + $(guess_rootdev) || continue
> case $resp in
> "?") diskinfo $(get_dkdevs);;
> '') ;;
>