diff --git a/configuration/system.nix b/configuration/system.nix index bd35f29c05b..5015f2d0d23 100644 --- a/configuration/system.nix +++ b/configuration/system.nix @@ -152,6 +152,7 @@ rec { pkgs.gzip pkgs.iputils pkgs.less + pkgs.lvm2 pkgs.module_init_tools pkgs.nano pkgs.netcat diff --git a/configuration/upstart.nix b/configuration/upstart.nix index bf2120968de..d89788ff7b7 100644 --- a/configuration/upstart.nix +++ b/configuration/upstart.nix @@ -26,6 +26,11 @@ import ../upstart-jobs/gather.nix { inherit (pkgs) writeText cleanSource udev procps; }) + # Makes LVM logical volumes available. + (import ../upstart-jobs/lvm.nix { + inherit (pkgs) kernel module_init_tools lvm2; + }) + # Hardware scan; loads modules for PCI devices. (import ../upstart-jobs/hardware-scan.nix { inherit (pkgs) kernel module_init_tools; diff --git a/upstart-jobs/lvm.nix b/upstart-jobs/lvm.nix new file mode 100644 index 00000000000..558b80cd651 --- /dev/null +++ b/upstart-jobs/lvm.nix @@ -0,0 +1,30 @@ +{kernel, module_init_tools, lvm2}: + +{ + name = "lvm"; + + job = " +start on udev +#start on new-devices + +script + + # Load the device mapper. + export MODULE_DIR=${kernel}/lib/modules/ + ${module_init_tools}/sbin/modprobe dm_mod || true + + # Scan for block devices that might contain LVM physical volumes + # and volume groups. + #${lvm2}/sbin/vgscan + + # Make all logical volumes on all volume groups available, i.e., + # make them appear in /dev. + ${lvm2}/sbin/vgchange --available y + + initctl emit new-devices + +end script + + "; + +}