mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-26 04:43:09 +03:00
* Activate software RAID arrays.
svn path=/nixos/trunk/; revision=7631
This commit is contained in:
parent
66d4c6c4e2
commit
daa8ecfe7a
@ -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
36
upstart-jobs/swraid.nix
Normal 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
|
||||
|
||||
";
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user