From 162181ffba4e6128c26781375d44bff0852b691b Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sun, 24 Dec 2006 01:07:28 +0000 Subject: [PATCH] * LVM support (in stage 2; having / on LVM is not yet supported). LVM triggers a new-devices event so that the filesystems job mounts file systems on the logical volumes. svn path=/nixos/trunk/; revision=7478 --- configuration/system.nix | 1 + configuration/upstart.nix | 5 +++++ upstart-jobs/lvm.nix | 30 ++++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 upstart-jobs/lvm.nix 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 + + "; + +}