1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-09-11 15:08:33 +01:00

* Activate software RAID arrays.

svn path=/nixos/trunk/; revision=7631
This commit is contained in:
Eelco Dolstra 2007-01-11 00:40:28 +00:00
parent 66d4c6c4e2
commit daa8ecfe7a
2 changed files with 41 additions and 0 deletions

View file

@ -31,6 +31,11 @@ import ../upstart-jobs/gather.nix {
inherit (pkgs) kernel module_init_tools lvm2;
})
# Activate software RAID arrays.
(import ../upstart-jobs/swraid.nix {
inherit (pkgs) kernel module_init_tools mdadm;
})
# Hardware scan; loads modules for PCI devices.
(import ../upstart-jobs/hardware-scan.nix {
inherit (pkgs) kernel module_init_tools;

36
upstart-jobs/swraid.nix Normal file
View file

@ -0,0 +1,36 @@
{kernel, module_init_tools, mdadm}:
let
tempConf = "/var/state/mdadm.conf";
in
{
name = "swraid";
job = "
start on udev
#start on new-devices
script
# Load the necessary RAID personalities.
export MODULE_DIR=${kernel}/lib/modules/
for mod in raid0 raid1 raid5; do
${module_init_tools}/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
";
}