On Wed, Nov 26, 2014 at 03:05:27AM -0500, Jean-Philippe Ouellet wrote:
> Hello,
> 
> 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.
> 
> The thinking is if you bothered to actually configure a softraid
> device, it's probably because you actually intend to use it, right?
> 
> 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.

Yes, the installer doesn't support softraid automagically yet.
It does however already work well if you answer its questions correctly.
This is because the bootloaders and kernel are making softraid mostly
transparent to the installer (apart from the initial bioctl setup step).

> If you think this describes the majority of softraid users, then
> I propose the following:

Last I heard the idea was to push such logic into bioctl or a new utility
because scripting it sucks. (Perhaps jsing@ can elaborate on that?)
 
Various diffs have been suggested for RAID support in the installer,
by myself and others. So far they've been rejected because they weren't
good enough.

In your case: What if I have a RAID1 volume mounted on /storage?
I'll always get the wrong suggestion with your diff whereas it worked before.
What if I have a crypto and a RAID1 volume configured? How do you know
which one is the root disk I want to upgrade? A scripted guess is probably
just as bad as the current default.

I think this needs some support from the bootloader and kernel to work right.

> 
> 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);;
>       '')     ;;

Reply via email to