Close

SSD and system logs.

My backup web server has a 8GB CF card. I want to reduce the number of writes to it as much as possible to save money and keep my server healthy. I added the following to my /etc/rc.local so that the logs files are created in RAM every time the server boots. The only downfall to this is that you will not have any logs if the system crashes to diagnose the problem, oh well =)

How it works:

1. Create the ram disk directory.
2. Mount the ram file system.
3. Erase old logs.
4. Use touch to create an empty log file in the ram disk directory.
5. Link the log file in the ram disk directory to /var/log

[ /etc/rc.local ]
#Creates a tmpfs RAM disk and mount it
mkdir /ramfs;mount -t tmpfs /dev/ram0 /ramfs;mkdir /ramfs/httpd
LOG[0]=messages
LOG[1]=secure
LOG[2]=maillog
LOG[3]=yum.log
LOG[4]=rpmpkgs
LOG[5]=dmesg
LOG[6]=boot.log
LOG[7]=spooler
LOG[8]=scrollkeeper.log
LOG[9]=cron
LOG[10]=Xorg.0.log
LOG[11]=acpid
LOG[12]=btmp
LOG[13]=wtmp

LOG[14]=httpd/access_log

LOG[15]=httpd/error_log

for ((c=0;c<=15;c++))
do
rm -f /var/log/${LOG[c]};touch /ramfs/${LOG[c]};ln -s /ramfs/${LOG[c]} /var/log/${LOG[c]}
done

2 thoughts on “SSD and system logs.

  1. I was under the impression that SSD chips these days are designed to withstand oodles and oodles of rewrites, thus making any need to treat them so gingerly, irrelevant. This belief that flash cards need to be spared numerous rewrites whenever possible has become a sort of urban myth that never dies. Quote: “With current technologies write endurance is not a factor you should be worrying about when deploying flash SSDs for server acceleration applications – even in a university or other analytics intensive environment.” From an article dated March 2007, and located here: http://www.storagesearch.com.sharedcopy.com/377afda8d5f9616fd767000b664fa018.html

    Otherwise, it’s a good exercise in learning how to make Linux work for you!

Leave a Reply