From 5de4a850ecbe9b0e8de35030b4f4bf32357ee412 Mon Sep 17 00:00:00 2001 From: Dag Wieers Date: Wed, 27 Mar 2013 23:15:54 +0100 Subject: [PATCH] Mount /var as tmpfs and limit the use of tmpfs This commit (apart from the cosmetic change to avoid using 'none') changes the use of ramfs into tmpfs. The reason for this is that ramfs usage can fill 100% of RAM and cannot be swapped out. While tmpfs can be swapped out and can be limited in size. The size chosen is arbitrary, but taking into account the ATV1 hardware 5% of 256MB means 12MB and 20% means 50MB, considering we have swap this is not too drastic. For any larger system, these sizes are fine as well as we do not expect /var or /dev/shm to be filled completely. So worst case is covered, but not expected. --- .../initramfs/sysutils/busybox-initramfs/scripts/init | 6 +++--- packages/sysutils/busybox/init.d/01_mount-filesystem | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/initramfs/sysutils/busybox-initramfs/scripts/init b/packages/initramfs/sysutils/busybox-initramfs/scripts/init index 5dcb5fa53f..7541981e88 100755 --- a/packages/initramfs/sysutils/busybox-initramfs/scripts/init +++ b/packages/initramfs/sysutils/busybox-initramfs/scripts/init @@ -23,9 +23,9 @@ ################################################################################ # mount all needed special filesystems - /bin/busybox mount -t devtmpfs none /dev - /bin/busybox mount -t proc none /proc - /bin/busybox mount -t sysfs none /sys + /bin/busybox mount -t devtmpfs devtmpfs /dev + /bin/busybox mount -t proc proc /proc + /bin/busybox mount -t sysfs sysfs /sys # set needed variables MODULE_DIR=/lib/modules diff --git a/packages/sysutils/busybox/init.d/01_mount-filesystem b/packages/sysutils/busybox/init.d/01_mount-filesystem index 1ae9128f70..0e95388875 100644 --- a/packages/sysutils/busybox/init.d/01_mount-filesystem +++ b/packages/sysutils/busybox/init.d/01_mount-filesystem @@ -25,10 +25,10 @@ progress "mounting needed filesystems" mkdir -p /dev/pts - mount -n -t devpts -o gid=5,mode=620 none /dev/pts + mount -n -t devpts -o gid=5,mode=620 devpts /dev/pts mkdir -p /dev/shm - mount -n -t tmpfs none /dev/shm + mount -n -t tmpfs -o size=20% tmpfs /dev/shm - mount -n -t ramfs none /var - mount -n -t debugfs none /sys/kernel/debug + mount -n -t tmpfs -o size=10m tmpfs /var + mount -n -t debugfs debugfs /sys/kernel/debug