Re: Proposed enhancements to MD

Andreas Steinmetz
2004-01-13T23:10:06Z

Wakko Warner wrote:
>
> As I've understood it, the configuration for DM is userspace and the kernel
> can't do any auto detection. This would be a "put off" for me to use as a
> root filesystem. Configurations like this (and lvm too last I looked at it)
> require an initrd or some other way of setting up the device. Unfortunately
> this means that there's configs in 2 locations (one not easily available, if
> using initrd. easily != mounting via loop!)
>

You can always do the following: use a mini root fs on the partition
where the kernel is located that does nothing but vgscan and friends and
then calls pivot_root. '/sbin/init' of the mini root fs looks like:

#!/bin/sh
case "$1" in
-s|S|single|-a|auto)
opt=$1
;;
-b|emergency)
export PATH=/bin:/sbin
/bin/mount /proc
/bin/loadkeys \
/keymaps/i386/qwertz/de-latin1-nodeadkeys.map.gz
exec /bin/sh < /dev/console > /dev/console 2>&1
;;
esac
cd /
/bin/mount /proc
/bin/mount -o remount,rw,notail,noatime,nodiratime /
/sbin/vgscan > /dev/null
/sbin/vgchange -a y > /dev/null
/bin/mount -o remount,ro,notail,noatime,nodiratime /
/bin/mount /mnt
/bin/umount /proc
cd /mnt
/sbin/pivot_root . boot
exec /bin/chroot . /bin/sh -c \
"/bin/umount /boot ; exec /sbin/init $opt" \
< dev/console > dev/console 2>&1

And if you have partitions of the same size on other disks and fiddle a
bit with dd you have perfect working backups including the boot loader
code of the master boot record on the other disks. No initrd required.
As an add-on you have an on-disk rescue system.
--
Andreas Steinmetz