#RAID2 hook for mkinitcpio r2_am () { modprobe -q "${1}" >/dev/null 2>&1 eval "${1}=1" } run_hook () { ## 1) discover which modules are actually needed fil=/etc/mdadm.conf if [ ! -f "${fil}" ] ; then #If user didn't supply proper mdadm.conf, create one. #Partitions in this case will be assembled as partitionable, #user SHOULD provide proper mdadm.conf for their system and #rebuild initramfs afterwards. echo "CREATE mode=0660 owner=0 group=6 auto=part16 symlinks=yes" >"${fil}" mdadm -Es >>"${fil}" fi while read dat ; do #get raid type per device lev="${dat##*level=}" lev="${lev%% metadata*}" #and load required module case "${lev}" in raid0 ) [ -z "${raid0}" ] && r2_am raid0 ;; raid1 ) [ -z "${raid1}" ] && r2_am raid1 ;; raid4 ) [ -z "${raid456}" ] && r2_am raid456 ;; raid5 ) [ -z "${raid456}" ] && r2_am raid456 ;; raid6 ) [ -z "${raid456}" ] && r2_am raid456 ;; linear ) [ -z "${linear}" ] && r2_am linear ;; multipath ) [ -z "${multipath}" ] && r2_am multipath ;; faulty ) [ -z "${faulty}" ] && r2_am faulty ;; esac done <"${fil}" ## 2) modules ready, now assembly # things to watch out for: # raid-partitions require access to device, to make linux actually # notice exisitng partitions. Without that, there will be no uevents # right after (dis)assembly, and lvm using sysfs will not check them # for lvm volumes (unless sysfs_scan = 0). The easiest thing to do # that, is just to run mdadm -As twice. # Neil knows about it, and according to him, current mdadm (2.6.4) # doesn't do mentioned access in one case. It should get fixed in # one of the future versions. If udev rules access device later # while processing the rules, i.e. through vol_id helper, # it would "self" trigger partitions uevents. # Either way, it's safer to just do it explicitely. /sbin/mdadm -As >/dev/null 2>&1 /sbin/mdadm -As >/dev/null 2>&1 } #RAID2 install for mkinitcpio install () { MODULES=" $(checked_modules "drivers/md/*" | grep -v "dm-") " BINARIES="mdadm" FILES="" SCRIPT="raid2" add_dir "/dev/md" add_file "/etc/mdadm.conf" } help () { cat</dev/null 2>&1 if [ -e "/sys/class/misc/device-mapper" ]; then - read dev_t < /sys/class/misc/device-mapper/dev - /bin/mknod "/dev/mapper/control" c $(/bin/replace "${dev_t}" ':') [ "${quiet}" = "y" ] && LVMQUIET=">/dev/null" msg "Scanning logical volumes..." - eval /bin/lvm vgscan --ignorelockingfailure $LVMQUIET + eval /bin/lvm vgscan --mknodes --ignorelockingfailure $LVMQUIET msg "Activating logical volumes..." eval /bin/lvm vgchange --ignorelockingfailure -ay $LVMQUIET fi