Use tmpfs to mount /tmp
authorHugo Villeneuve <hugo@hugovil.com>
Fri, 23 Aug 2013 00:36:34 +0000 (20:36 -0400)
committerHugo Villeneuve <hugo@hugovil.com>
Thu, 31 Jul 2014 02:15:23 +0000 (22:15 -0400)
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
config/sysinfos.default
stage1/bootscripts/cleanfs
stage1/bootscripts/mountkernfs
stage1/create-config-files

index 1f34502..fb51bec 100644 (file)
@@ -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"
index e2e29d0..a1140b3 100644 (file)
@@ -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=""
 
index 48c2fdc..1efde79 100755 (executable)
@@ -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
 
index a81cf62..e0552af 100755 (executable)
@@ -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
        ;;
 
index 35ef06a..1dbb9be 100755 (executable)
@@ -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"