From 68ebbb6093e64c89fbacd7332862a10c9ef48c9c Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sun, 29 Aug 2010 22:29:10 +0000 Subject: [PATCH] * Put /nix on /ephemeral0 using AUFS (with the original /nix from the AMI as a base) because the root filesystem is rather small. svn path=/nixos/trunk/; revision=23534 --- modules/virtualisation/amazon-image.nix | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/modules/virtualisation/amazon-image.nix b/modules/virtualisation/amazon-image.nix index 3a56116eec6c..5108eb4f58e0 100644 --- a/modules/virtualisation/amazon-image.nix +++ b/modules/virtualisation/amazon-image.nix @@ -68,9 +68,11 @@ with pkgs.lib; swapDevices = [ { device = "/dev/xvdb"; } ]; - boot.initrd.kernelModules = [ "xen-blkfront" ]; + boot.initrd.kernelModules = [ "xen-blkfront" "aufs" ]; boot.kernelModules = [ "xen-netfront" ]; + boot.extraModulePackages = [ config.boot.kernelPackages.aufs2 ]; + # Generate a GRUB menu. Amazon's pv-grub uses this to boot our kernel/initrd. boot.loader.grub.device = "nodev"; boot.loader.grub.timeout = 0; @@ -79,13 +81,18 @@ with pkgs.lib; # Put /tmp and /var on /ephemeral0, which has a lot more space. # Unfortunately we can't do this with the `fileSystems' option # because it has no support for creating the source of a bind - # mount. + # mount. Also, "move" /nix to /ephemeral0 by layering an AUFS + # on top of it so we have a lot more space for Nix operations. boot.initrd.postMountCommands = '' mkdir -m 1777 -p $targetRoot/ephemeral0/tmp mount --bind $targetRoot/ephemeral0/tmp $targetRoot/tmp + mkdir -m 755 -p $targetRoot/ephemeral0/var mount --bind $targetRoot/ephemeral0/var $targetRoot/var + + mkdir -m 755 -p $targetRoot/ephemeral0/nix + mount -t aufs -o dirs=$targetRoot/ephemeral0/nix=rw:$targetRoot/nix=rr none $targetRoot/nix ''; # There are no virtual consoles.