eeePCs use solid state disks (SSD). I don't know if the lifespan of SSDs is a real issue for the average user, but I wanted to reduce writings anyway. This article pointed me (paragraph "Which file system should you use?") to the redirection of logs to /dev/null, but I didn't find any instruction on how to make it once and for all (I don't like running scripts every time an application is added or removed). This program (ramlog) pointed me to redirect logs to ram.
I tried installing ramlog on my eeePC 900, but without success.
I tried to mount /var/log on a ramdisk in fstab, but it didn't work because it results in an empty folder, while many programs need their own subfolder, otherwise they don't go (like kismet, for example).
So I tried my way.
And then made a variant. It is useful if you don't need to keep the logs from the old sessions: only logs of the current session are written to ram and then discarded at shutdown.
My steps were:
- make a new folder /var/log-save-dir;
- copy only the directory structure of /var/log to /var/log-save-dir:
- delete (or rename for a spare copy) /var/log;
- make a symbolic link: /var/log points to /var/log-save-dir (in this manner, programs work as usual until the scripts are completed and running);
- in /usr/local/sbin create a simple script named "log-up" to be called at startup in order to:
- create a directory /tmp/log;
- move content of /var/log-save-dir to /tmp/log;
- remove link /var/log, (which is pointing to /var/log-save-dir);
- make new link /var/log, pointing now to /tmp/log;
- in /usr/local/sbin create a simple script named "log-down", to be called at shutdown/reboot in order to:
- copy all folders only from /tmp/log back to /var/log-save-dir (just in case you installed some program which requires its own log folder);
- in /usr/bin, edit "startsimple.sh" by adding at the beginning a call to "log-up" (bold lines):
- in /usr/bin, edit "startfull.sh" by adding at the beginning a call to "log-up" (bold lines):
- in /sbin, edit "fastshutdown.sh" by adding a call to "log-down" (bold lines):
- in /sbin, edit "fastreboot.sh" by adding a call to "log-down" (bold lines):
- reboot.
prompt/> cd /var/log-save-dir
prompt/> (cd /var/log; find -type d ! -name .) | xargs mkdir
#!/bin/bash
mkdir /tmp/log
mv /var/log-save-dir/* /tmp/log
unlink /var/log
ln -s /tmp/log /var/log
#!/bin/bash
cd /var/log-save-dir
(cd /tmp/log; find -type d ! -name .) | xargs mkdir
cd /
unlink /var/log
ln -s /var/log-save-dir /var/log
#!/bin/sh
# change logging dir
sudo /usr/local/sbin/log-up
sudo /usr/bin/sessreg -d -l :0.0 -u /var/run/utmp user
xhost + si:localuser:root # Allow local user root only to access the display
...
#!/bin/sh
# change logging dir
sudo /usr/local/sbin/log-up
touch /home/user/.kdesession #changed
killall xinit
#!/bin/sh
if [ "$1" = "--ask" ]
then
zenity --question && sudo $0
exit $?
fi
[ `id -u` = "0" ] || echo "Must be root."
# revert logging dir
/usr/local/sbin/log-down
/usr/bin/killall --wait usbstorageapplet
/bin/kill -USR2 1
#!/bin/sh
if [ "$1" = "--ask" ]
then
zenity --question && sudo $0
exit $?
fi
[ `id -u` = "0" ] || echo "Must be root."
# revert logging dir
/usr/local/sbin/log-down
/usr/bin/killall --wait usbstorageapplet
/bin/kill -USR1 1
If you care about keeping the full log history, you may opt for similar scripts which save all the logs up to ram and down to disk, but be prepared to an increasing bootup and shutdown time.