Re: Failover root devices

From: Ortwin GlÃck
Date: Thu Sep 17 2015 - 07:40:35 EST


> I would like to see Linux support multiple root devices

You can do that completely in user space from an initramfs.

From your init script you can do what you want. You may even parse /proc/cmdline and use the root= parameter as you propose. Then mount whatever root device you want by whatever method you like and finally
exec switch_root /mnt/root /sbin/init "$@"

See here for example scripts for initramfs:
http://www.linuxfromscratch.org/blfs/view/svn/postlfs/initramfs.html

Above script actually makes it easy by supporting disk labels: root=LABEL=ROOT will boot the first available partition that is labelled ROOT. It is independent of the device name and works nice when you switch hardware vs. virtual machines for instance.

Ortwin

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/