2009-10-12 18:36:19 +02:00
|
|
|
{ config, pkgs, ... }:
|
2009-03-06 13:27:30 +01:00
|
|
|
|
|
|
|
###### implementation
|
2007-01-11 01:40:28 +01:00
|
|
|
|
|
|
|
let
|
|
|
|
|
2007-01-23 21:09:06 +01:00
|
|
|
tempConf = "/var/run/mdadm.conf";
|
2009-03-06 13:27:30 +01:00
|
|
|
modprobe = config.system.sbin.modprobe;
|
|
|
|
inherit (pkgs) mdadm;
|
2007-01-11 01:40:28 +01:00
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
|
2009-10-12 20:09:34 +02:00
|
|
|
jobs.swraid =
|
2009-10-12 18:36:19 +02:00
|
|
|
{ startOn = "udev"; # !!! or on "new-devices"
|
2009-03-06 13:27:30 +01:00
|
|
|
|
2009-10-12 18:36:19 +02:00
|
|
|
script =
|
|
|
|
''
|
2009-03-06 13:27:30 +01:00
|
|
|
# Load the necessary RAID personalities.
|
|
|
|
# !!! hm, doesn't the kernel load these automatically?
|
|
|
|
for mod in raid0 raid1 raid5; do
|
|
|
|
${modprobe}/sbin/modprobe $mod || true
|
|
|
|
done
|
|
|
|
|
|
|
|
# Scan /proc/partitions for RAID devices.
|
|
|
|
${mdadm}/sbin/mdadm --examine --brief --scan -c partitions > ${tempConf}
|
|
|
|
|
|
|
|
# Activate each device found.
|
|
|
|
${mdadm}/sbin/mdadm --assemble -c ${tempConf} --scan
|
|
|
|
|
|
|
|
initctl emit new-devices
|
2009-10-12 18:36:19 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
task = true;
|
|
|
|
};
|
|
|
|
|
2007-01-11 01:40:28 +01:00
|
|
|
}
|