3
0
Fork 0
forked from mirrors/nixpkgs

Making the /dev and /dev/shm tmpfs sizes configurable.

By default, they take the usual value of "50% of physical RAM".

As /dev/shm can be filled by anyone, and tmpfs does not trigger the OOM killer (and
can hang the machine due to a lack of RAM), I need to configure that down
in order to avoid crashes.

There is still left the /var/run/nscd tmpfs filesystem, also created with 50%
of the RAM, but at least not writeable by anyone. We could find a reasonable
low value for that, or allow configuration.


svn path=/nixos/trunk/; revision=21140
This commit is contained in:
Lluís Batlle i Rossell 2010-04-17 15:20:13 +00:00
parent 1c9eb048c9
commit 33ed225a84
2 changed files with 31 additions and 9 deletions

View file

@ -82,9 +82,9 @@ done
mkdir -m 0755 -p /sys
mount -t sysfs none /sys
mkdir -m 0755 -p /dev
mount -t tmpfs -o "mode=0755" none /dev
mount -t tmpfs -o "mode=0755,size=@devSize@" none /dev
mkdir -m 0777 /dev/shm
mount -t tmpfs -o "rw,nosuid,nodev" tmpfs /dev/shm
mount -t tmpfs -o "rw,nosuid,nodev,size=@devShmSize@" tmpfs /dev/shm
mkdir -m 0755 -p /dev/pts
mount -t devpts -o mode=0600,gid=@ttyGid@ none /dev/pts
[ -e /proc/bus/usb ] && mount -t usbfs none /proc/bus/usb # uml doesn't have usb by default

View file

@ -4,13 +4,34 @@ let
options = {
boot.postBootCommands = pkgs.lib.mkOption {
default = "";
example = "rm -f /var/log/messages";
merge = pkgs.lib.mergeStringOption;
description = ''
Shell commands to be executed just before Upstart is started.
'';
boot = {
postBootCommands = pkgs.lib.mkOption {
default = "";
example = "rm -f /var/log/messages";
merge = pkgs.lib.mergeStringOption;
description = ''
Shell commands to be executed just before Upstart is started.
'';
};
devSize = pkgs.lib.mkOption {
default = "50%";
example = "32m";
description = ''
Size limit for the /dev tmpfs. Look at mount(8), tmpfs size option,
for the accepted syntax.
'';
};
devShmSize = pkgs.lib.mkOption {
default = "50%";
example = "256m";
description = ''
Size limit for the /dev/shm tmpfs. Look at mount(8), tmpfs size option,
for the accepted syntax.
'';
};
};
};
@ -23,6 +44,7 @@ let
src = ./stage-2-init.sh;
isExecutable = true;
inherit kernel activateConfiguration;
inherit (config.boot) devSize devShmSize;
ttyGid = config.ids.gids.tty;
upstart = config.system.build.upstart;
path =