11 Haziran 2013 Salı

Ramlog - Raspberry Pi


SD CARD

An SD Card has a limited lifetime, it depends on various factors. Normally the lifetime declared by manufacturers is very long, but I have experienced that sometimes the lifetime is very short. °v°.

So taking care of the healt status of the SD CARDs could lead to a high reliability.

One of the factors that could broke your SD Card is the write cycles. As said, this number is normally very high but you cannot say if your SD CARD will have a behaviur in the average or under the average. So you can think to reduce the number of writes.

 

 



The /var/log directory contains the log files for your services and these files are often updated, if you have a lot of services running you have a lot of writes on your SD CARD, if the log files are not essential in your system you can move them on a RAM disk and then you can backup them when you want.

In my production system I'm using a tool that does the job: Ramlog.

"Ramlog act as a system daemon. On startup it creates ramdisk, it copies files from /var/log into ramdisk and mounts ramdisk as /var/log. All logs after that will be updated on ramdisk. Logs on harddrive are kept in folder /var/log.hdd which is updated when ramlog is restarted or stopped. On shutdown it saves log files back to harddisk so logs are consistent. Ramlog 2.x is using tmpfs by default, ramfs and kernel ramdisk are suppored as well. Program rsync is used for log synchronization."

To install Ramlog on your Raspbian system run the following instructions:

# sudo apt-get install lsof

# wget http://www.tremende.com/ramlog/download/ramlog-2.0.0.tar.gz

# cp -a ramlog /etc/init.d/ramlog

# cp -a ramlog.8.gz /usr/share/man/man8/ramlog.8.gz

# cp -a ramlog.cron /etc/cron.daily    #or to other dir based on your need

# cp -a ramlog.logrotate /etc/logrotate.d/ramlog

# cp -a ramlog.conf /etc/default/ramlog

 

With your favourite editor, edit the file /etc/default/ramlog and set the value for your RAM filesystem, for example TMPFS_RAMFS_SIZE=20 means you want to use 20 mega bytes of RAM.

You can retrieve the actual size for /var/log directory issueing the following command:

# ramlog getlogsize

 

Last, reboot your system

# sudo reboot -n

 



















Hiç yorum yok: