You are not logged in.
In order to mount tmpfs on /tmp at system startup, one should probably change the rc.sysinit script, which doesn't feel as comfortable as editing rc.conf.
I have a suggestion that may simplify this, by using something we could call SIMs (for SysInit Modules).
A SIM aims to simplify system initialization by spliting file rc.sysinit into modules, which can then be enabled or disabled in rc.conf.
Let's take a look at some patches:
Patch for rc.sysinit:
----------------------------------------------------------
@@ -313,6 +313,17 @@
stat_done
fi
+# Start SIMs (sysinit modules)
+for sim in "${SIMS[@]}"; do
+ if [ "$sim" = "${sim#!}" ]; then
+ if [ "$sim" = "${sim#@}" ]; then
+ start_sim $sim
+ else
+ start_sim_bkgd ${sim:1}
+ fi
+ fi
+done
+
stat_busy "Removing Leftover Files"
/bin/rm -f /etc/nologin &>/dev/null
/bin/rm -f /etc/shutdownpid &>/dev/null@@ -28,6 +28,17 @@
USECOLOR="yes"
----------------------------------------------------------
Patch for rc.conf:
----------------------------------------------------------
# -----------------------------------------------------------------------
+# SIMS (sysinit modules)
+# -----------------------------------------------------------------------
+#
+# Sysinit modules (SIMs) aim to simplify system initialization
+# - prefix a SIM with a ! to disable it (some SIMs are essential, so beware)
+# - prefix a SIM with a @ to start it up in the background (is it useful?)
+#
+#
+SIMS=(tmp-on-ram)
+
+# -----------------------------------------------------------------------
# HARDWARE
# -----------------------------------------------------------------------
#
----------------------------------------------------------
New file: /etc/rc.sim/functions:
----------------------------------------------------------
#
# SIM (sysinit module) functions
#
# sysinit modules:
start_sim() {
if [ -x /etc/rc.sim/$1 ]; then
stat_busy "Loading SIM $1"
/etc/rc.sim/$1
stat_done
fi
}
start_sim_bkgd() {
stat_bkgd "Loading SIM $1"
(/etc/rc.sim/$1) &>/dev/null &
}
# End of file
----------------------------------------------------------
New file: /etc/rc.sim/tmp-on-ram:
----------------------------------------------------------
#! /bin/bash
# SIM that mounts tmpfs on /tmp
# Requirement : RAM >= 256 MB
# SWAP >= 512 MB
#
# Modified by Elifarley Cruz
# Based on rc.tmpfs By Eko M. Budi
# Released under the GPL
# Load before "Removing Leftover files"
# TODO Put configuration in file /etc/conf.d/sim/tmp-on-ram
SIZE=1024M
INODE=16M
if cat /proc/filesystems | grep -qe "tmpfs$" ; then
mount -t tmpfs tmpfs /tmp -o size=$SIZE,nr_inodes=$INODE,mode=1777
fi
#### Delete the line below for production use
sleep 8
----------------------------------------------------------
So, do you guys think this idea is worth applying to ArchLinux?
Regards,
Elifarley
Google Buzz: http://bit.ly/elifarley-buzz
Google Reader: http://bit.ly/elifarley-reader
Bookmarks: http://delicious.com/elifarley | http://twitter.com/elifarley
Professional info: http://br.linkedin.com/in/elifarley | http://openhatch.org/people/elifarley/
Offline
Uhhhmm... What does this achieve over just adding the below to /etc/fstab?
tmpfs /tmp tmpfs size=1g 0 0Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
I my systems i enabled /tmp as tmpfs by putting just one line in /etc/fstab
none /tmp tmpfs nodev,nosuid,mode=1777 0 0Offline
In a nutshell what your aiming for is making tmp faster by placing it in RAM rather than the hard drive?
Interesting idea. I can see the advantage for those who do compiling work with the tmp folder. If I find that I start using the tmp more than once a week, I will definitely give this a try.
Thank you for the work!
I keep getting distracted from my webserver project...
huh? oooh... shiny!
Offline
Uhhhmm... What does this achieve over just adding the below to /etc/fstab?
I my systems i enabled /tmp as tmpfs by putting just one line in /etc/fstab
I think the idea here is to modularize sysinit, not just for this /tmp thing, but for other uses as well.
OP: I don't know much about the things sysinit does, and I can't bother to look now because I'm at work, but I can tell you that ideas like this posted to the bbs often go unheard. If you are serious about this and genuinely think there is an advantage to it, it would be best to file a feature request in the bug tracker. Devs don't always read the bbs.
archlinux - please read this and this — twice — then ask questions.
--
http://rsontech.net | http://github.com/rson
Offline
I think the idea here is to modularize sysinit, not just for this /tmp thing, but for other uses as well.
Modularizing things is good, but does anyone have any other candidates for modularization in this context? Doing it for one task isn't really worth it, but if there's a few things that can be added then it sounds good. I can't think of anything off the top of my head.
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
Well you could do modesetting this way couldnt you? Though adding it to initrd is far easier
Offline