pdaXrom: /var/log/ ins RAM verlegen
03 07 2005Um das Logverzeichnis ins RAM zu verlegen, sind nur wenige kleine Aktionen nötig.
# cp /etc/rc.d/rc.rofilesys /home/root/rc.rofilesys.bak
# cp /home/root/rc.rofilesys.bak /home/root/rc.rofilesys.new
# vi /home/root/rc.rofilesys.newUnter allen Vorkommen der Doppelzeile
mkdir /dev/shm/tmp
mkdir /dev/shm/rundie Zeile "
mkdir /dev/shm/log" einfügen (insgesamt zwei Mal). Dann# mv /home/root/rc.rofilesys.new /etc/rc.d/rc.rofilesys
# mv /var/log/ /var/log.bak
# ln -s /dev/shm/log /var/log
# rebootund nach dem Neustart liegen die Logdateien im RAM. Die Größe des unter /dev/shm/ gemounteten tmpfs wird in der /etc/rc.d/rc.rofilesys übrigens auf 12 MB beschränkt, so daß der Hauptspeicher nicht vollaufen kann. Trotzdem sollte man darauf achtgeben, das Dateisystem nicht zu füllen. Außerdem ist zu bedenken, daß nun die Startskripte aller Dienste angepaßt werden müssen, die in Verzeichnisse unterhalb von /var/log/ schreiben wollen.
Für lighttpd zum Beispiel muß die /etc/rc.d/init.d/lighttpd vor dem Aufruf des Daemons nun etwa wie folgt geändert werden:
# Create the log dir, if necessary
if [ ! -d /var/log/lighttpd/ ]; then
mkdir /var/log/lighttpd/
chown nobody:nobody /var/log/lighttpd/
fi[See English translation below]
pdaXrom: relocating /var/log/ to RAM
Relocating the log directory to RAM needs just a few small actions.
# cp /etc/rc.d/rc.rofilesys /home/root/rc.rofilesys.bak
# cp /home/root/rc.rofilesys.bak /home/root/rc.rofilesys.new
# vi /home/root/rc.rofilesys.newBelow all occurrences of the double line
mkdir /dev/shm/tmp
mkdir /dev/shm/runadd the line "
mkdir /dev/shm/log" (two times overall). Then# mv /home/root/rc.rofilesys.new /etc/rc.d/rc.rofilesys
# mv /var/log/ /var/log.bak
# ln -s /dev/shm/log /var/log
# rebootand the log files are in RAM after the reboot. The size of the tmpfs which is mounted on /dev/shm/ is restricted to 12 MB in /etc/rc.d/rc.rofilesys by the way, so the main memory won't be flooded. You should look out to not fill the file system nonetheless. Apart from that you should keep in mind that all init scripts of services that write to subdirectories below /var/log/ have to be modified now.
In the case of lighttpd for instance the /etc/rc.d/init.d/lighttpd has to be altered as follows before calling the Daemon:
# Create the log dir, if necessary
if [ ! -d /var/log/lighttpd/ ]; then
mkdir /var/log/lighttpd/
chown nobody:nobody /var/log/lighttpd/
fiKommentare : Noch keine Kommentare »
Trackbacks : 1 Trackback »
Als PDF ansehen: Dieser Artikel | Dieser Monat | Vollständiges Blog

Aufgenommen: Jul 05, 00:40