From 1083076034a8c41028e0587f302bfc8cfdb776af Mon Sep 17 00:00:00 2001 From: Hugo Villeneuve Date: Thu, 22 Aug 2013 20:36:34 -0400 Subject: [PATCH] Use tmpfs to mount /tmp Add optional size for /tmp partition. By default, tmpfs will reserve up to half the RAM for any tmpfs filesystem without a specific size. --- config/acer-731/sysinfos | 1 + config/sysinfos.default | 3 +++ stage1/bootscripts/cleanfs | 3 --- stage1/bootscripts/mountkernfs | 1 + stage1/create-config-files | 3 +++ 5 files changed, 8 insertions(+), 3 deletions(-) diff --git a/config/acer-731/sysinfos b/config/acer-731/sysinfos index 1f34502..fb51bec 100644 --- a/config/acer-731/sysinfos +++ b/config/acer-731/sysinfos @@ -14,6 +14,7 @@ LFS="/mnt/rescue" LFS_PARTITION="/dev/sda3" BOOT_PARTITION="/dev/sda1" SWAP_PARTITION="/dev/sda2" +TMP_PARTITION_SIZE="10G" # New user to create REGUSER="hugo" diff --git a/config/sysinfos.default b/config/sysinfos.default index e2e29d0..a1140b3 100644 --- a/config/sysinfos.default +++ b/config/sysinfos.default @@ -28,6 +28,9 @@ LFS="/mnt/hvlinux" #BOOT_PARTITION="/dev/sdb1" #SWAP_PARTITION="/dev/sdb2" +# /tmp is now mounted with tmpfs. +TMP_PARTITION_SIZE="8G" + # New user to create REGUSER="" diff --git a/stage1/bootscripts/cleanfs b/stage1/bootscripts/cleanfs index 48c2fdc..1efde79 100755 --- a/stage1/bootscripts/cleanfs +++ b/stage1/bootscripts/cleanfs @@ -12,9 +12,6 @@ clean_files() { failed=0 - cd /tmp && - find . -xdev -mindepth 1 ! -name lost+found ! -name trash -delete || failed=1 - cd /var/lock && find . -type f ! -newer /proc -exec rm -f {} \; || failed=1 diff --git a/stage1/bootscripts/mountkernfs b/stage1/bootscripts/mountkernfs index a81cf62..e0552af 100755 --- a/stage1/bootscripts/mountkernfs +++ b/stage1/bootscripts/mountkernfs @@ -14,6 +14,7 @@ case "$1" in # which we are in the process of mounting). cmd_run_log_box "Mounting /proc" mount -n /proc cmd_run_log_box "Mounting /sys" mount /sys + cmd_run_log_box "Mounting /tmp" mount /tmp cmd_run_log_box "Mounting /run" mount /run ;; diff --git a/stage1/create-config-files b/stage1/create-config-files index 35ef06a..1dbb9be 100755 --- a/stage1/create-config-files +++ b/stage1/create-config-files @@ -20,12 +20,15 @@ cat >> ${LFS}/etc/fstab << "EOF" proc /proc proc defaults 0 0 sysfs /sys sysfs defaults 0 0 tmpfs /run tmpfs defaults 0 0 +tmpfs /tmp tmpfs defaults,mode=1777,size=_TMP_PARTITION_SIZE_ 0 0 devpts /dev/pts devpts gid=4,mode=620 0 0 shm /dev/shm tmpfs defaults 0 0 /dev/dvd /media/dvd auto noauto,ro,users EOF +sed -i -e "s!_TMP_PARTITION_SIZE_!${TMP_PARTITION_SIZE}!g" ${LFS}/etc/fstab + echo "Creating basic /etc/profile and /etc/profile.d" install -v -m755 -d ${LFS}/etc/profile.d cat > ${LFS}/etc/profile << "EOF" -- 2.20.1