HOWTO: Using tmpfs for /tmp, /var/{log,run,lock...}

Share your own howto's etc. Not for support questions!

Re: HOWTO: Using tmpfs for /tmp, /var/{log,run,lock...}

Postby kevmitch » 2011-07-07 04:04

This should probably be mounting to /run now instead of /dev/shm. There are now options in /etc/default/rcS to make /tmp and /dev/shm as symlinks to /run.
Code: Select all
RAMRUN=yes
RAMLOCK=yes
RAMSHM=yes
RAMTMP=yes
kevmitch
 
Posts: 498
Joined: 2008-01-29 20:43

Re: HOWTO: Using tmpfs for /tmp, /var/{log,run,lock...}

Postby friese » 2011-07-07 20:05

Are you sure that will work in debian squeeze? I just had a look in the rcS manpage an I only found RAMRUN and RAMLOCK. Another question I'm having ist if there are any more directories than /tmp /var/log /var/run /var/lock /var/tmp and /media (which is where I auto-create and delete directories for mounting USB-Drives when they are connected) that have to be moved to a tmpfs in order to prevent our poor little CF-cards from beeing destroyed too soon? /swap is of course turned off.

cu, Jens
friese
 
Posts: 7
Joined: 2011-07-06 18:26

Re: HOWTO: Using tmpfs for /tmp, /var/{log,run,lock...}

Postby promitheus » 2011-09-19 11:05

Thanks for the fine article!

in order for the script to work in Uubtu 10.04 LTS i added in /etc/init.d/my-tmpfs.sh after "touch /var/log/wtmp the line"
touch /var/log/btmp

also in line "[-f /etc/init.d/ipw3945d ]" && there should be a space between [ and - so the line should be
[ -f /etc/init.d/ipw3945d ] &&

Also apt is protesting with "E: Directory '/var/log/apt/' missing"

Also from the whole /var/log directory with entries like above
root@ubuntu:/var/log# ls -la
total 2472
drwxr-xr-x 9 root root 4096 2011-09-19 14:17 .
drwxr-xr-x 13 root root 4096 2011-09-19 11:54 ..
drwxr-xr-x 2 root root 4096 2011-01-20 19:43 apparmor
drwxr-xr-x 2 root root 4096 2011-09-19 11:57 apt
-rw-r--r-- 1 root root 3660 2011-09-19 12:03 aptitude
-rw-r----- 1 syslog adm 19874 2011-09-19 14:19 auth.log
-rw-r----- 1 root adm 31 2011-09-19 11:55 boot
-rw-r--r-- 1 root root 256 2011-09-19 14:17 boot.log
-rw-rw-r-- 1 root utmp 0 2011-09-19 11:54 btmp
-rw-r----- 1 syslog adm 15008 2011-09-19 14:17 daemon.log
-rw-r----- 1 syslog adm 73775 2011-09-19 14:17 debug
drwxr-xr-x 2 root root 4096 2010-10-14 09:48 dist-upgrade
-rw-r----- 1 root adm 24008 2011-09-19 14:17 dmesg
-rw-r----- 1 root adm 23831 2011-09-19 14:12 dmesg.0
-rw-r----- 1 root adm 8305 2011-09-19 12:37 dmesg.1.gz
-rw-r----- 1 root adm 8387 2011-09-19 12:25 dmesg.2.gz
-rw-r----- 1 root adm 8400 2011-09-19 12:18 dmesg.3.gz
-rw-r----- 1 root adm 59 2011-09-19 11:55 dmesg.4.gz
-rw-r--r-- 1 root root 292867 2011-09-19 12:24 dpkg.log
-rw-r--r-- 1 root root 24024 2011-09-19 12:10 faillog
drwxr-xr-x 2 root root 4096 2011-09-19 11:55 fsck
drwxr-xr-x 3 root root 4096 2011-09-19 12:18 installer
-rw-r----- 1 syslog adm 604864 2011-09-19 14:17 kern.log
-rw-rw-r-- 1 root utmp 292292 2011-09-19 14:19 lastlog
-rw-r----- 1 syslog adm 0 2011-09-19 12:18 lpr.log
-rw-r----- 1 syslog adm 0 2011-09-19 12:18 mail.err
-rw-r----- 1 syslog adm 0 2011-09-19 12:18 mail.info
-rw-r----- 1 syslog adm 0 2011-09-19 12:18 mail.log
-rw-r----- 1 syslog adm 0 2011-09-19 12:18 mail.warn
-rw-r----- 1 syslog adm 534331 2011-09-19 14:17 messages
drwxr-xr-x 2 root root 4096 2011-09-19 12:18 news
-rw-r--r-- 1 root root 0 2011-09-19 11:57 pycentral.log
-rw-r----- 1 syslog adm 630909 2011-09-19 14:17 syslog
-rw-r--r-- 1 root root 134042 2011-09-19 14:17 udev
-rw-r----- 1 syslog adm 0 2011-09-19 12:18 ufw.log
drwxr-xr-x 2 root root 4096 2011-01-15 02:48 unattended-upgrades
-rw-r----- 1 syslog adm 0 2011-09-19 12:18 user.log
-rw-rw-r-- 1 root utmp 21888 2011-09-19 14:19 wtmp

after the script there are only

root@ubuntu:/var/log# ls -la
total 4
drwxr-xr-x 3 root root 120 2011-09-19 14:23 .
drwxr-xr-x 13 root root 4096 2011-09-19 11:54 ..
-rw------- 1 root root 0 2011-09-19 14:23 btmp
-rw-r--r-- 1 root utmp 0 2011-09-19 14:23 lastlog
drwxr-sr-x 2 news news 40 2011-09-19 14:23 news
-rw-r--r-- 1 root root 0 2011-09-19 14:23 wtmp

Finally because the script possibly(?) runs after ssh for a reason, i do not have ssh working (netstat shows listening on 22) so i tried to overcome the problem with Provides and Required-start as friese noticed with no luck. I overcomed the problem by restarting ssh script in /etc/rc.local

Is there a way for the script to run before all other scripts?

Thanks again
promitheus
 
Posts: 1
Joined: 2011-09-19 10:54

Previous

Return to Docs, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 5 guests

fashionable