2009-03-06 12:27:30 +00:00
|
|
|
{pkgs, config, ...}:
|
|
|
|
|
|
|
|
###### implementation
|
2007-01-11 00:40:28 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
|
2007-01-23 20:09:06 +00:00
|
|
|
tempConf = "/var/run/mdadm.conf";
|
2009-03-06 12:27:30 +00:00
|
|
|
modprobe = config.system.sbin.modprobe;
|
|
|
|
inherit (pkgs) mdadm;
|
2007-01-11 00:40:28 +00:00
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
|
2009-03-06 12:27:30 +00:00
|
|
|
services = {
|
|
|
|
extraJobs = [{
|
|
|
|
name = "swraid";
|
|
|
|
|
|
|
|
job = ''
|
|
|
|
start on udev
|
|
|
|
#start on new-devices
|
|
|
|
|
|
|
|
script
|
|
|
|
|
|
|
|
# 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
|
|
|
|
|
|
|
|
end script
|
|
|
|
|
|
|
|
'';
|
|
|
|
}];
|
|
|
|
};
|
2007-01-11 00:40:28 +00:00
|
|
|
}
|