User avatar
kspn
Posts: 68
Joined: Mon Jan 16, 2012 9:52 pm
Location: Melbourne

Log files & SD Card wear

Tue Aug 07, 2012 11:26 pm

Hi,

I have been playing with my RasPi (and loving it :D ) but I was wondering if the log files were going to cause issues for the system :? .

As a result of this I was considering moving the log files to a tempfs with the issue being that log files are not stored between sessions. :geek:

Just wondering what people thought about this? (I am also wondering if my SQLite db file will cause problems over time but I am less concerned with that as there is much less data write, it is 95% read)

kspn
No Coffee, No Workee

ejsolutions
Posts: 96
Joined: Fri Jun 29, 2012 2:27 pm
Location: In the sticks of Haggisland

Re: Log files & SD Card wear

Wed Aug 08, 2012 12:39 am

Yes, I've being doing a little tweaking to logrotate, reducing the number of saved files and compression of the saved logs. If anything, it saves on disc space but there's still writing going on. I'm sure that there must be some that can be turned off and only resumed for debugging purposes.

User avatar
fos
Posts: 104
Joined: Wed Nov 16, 2011 1:48 am
Location: Texas & Kansas, United States
Contact: Website

Re: Log files & SD Card wear

Wed Aug 08, 2012 7:53 am

SD cards do have a finite number of R/W cycles. Are any of the power users seeing a degradation in reliability?

Has anyone calculated a theroretical lifespan for SD cards running R PI?

Thank you,
Jeff
https://faroutscience.com

obcd
Posts: 917
Joined: Sun Jul 29, 2012 9:06 pm

Re: Log files & SD Card wear

Thu Aug 09, 2012 9:49 am

sd cards normally should have a wear levelling algoritm build in. This means that the card keeps track of how many times a block got erased and reprogrammed. It tries to keep these numbers equal for every block on the card. So it's not like the same block containing the log file will be rewritten every time.
Things can be improved without much trouble by taking an sd card of a bigger size. It simply means there are more blocks that can be erased and rewritten. As long as you avoid logfiles that change every millisecond, I don't think you have to worry about the sdcard going bad. After all, solid state drives use similar technology if I remember well, and no one seems to ask the question how long they will work.

james968
Posts: 29
Joined: Tue Jul 17, 2012 8:52 am

Re: Log files & SD Card wear

Thu Aug 09, 2012 10:15 am

If you have another Linux/UNIX box on your network, then you can configure syslog to send the logs to that box instead.

*.* @x.x.x.x

James

Elect
Posts: 11
Joined: Tue Aug 07, 2012 7:48 am
Location: Netherlands

Re: Log files & SD Card wear

Mon Aug 13, 2012 5:16 pm

I was looking for a solution to the same problem as well. I'm using my Pi as a webserver and I don't want it to last for a few months before I can buy a new SD card and start all over again.

I found a script called Ramlog which is available for Debian as well. I made a tutorial on my implementation and how you can install it:

http://piserv.nl/blog/index.php/using-t ... pberry-pi/

Harrkev
Posts: 22
Joined: Mon Feb 27, 2012 4:56 pm

Re: Log files & SD Card wear

Tue Aug 14, 2012 8:11 pm

With a 4G card being easily available for under $10 USD, if it wears out after two years, toss it and throw another one in.

SirLagz
Posts: 1705
Joined: Mon Feb 20, 2012 8:53 am
Location: Perth, Australia
Contact: Website

Re: Log files & SD Card wear

Wed Aug 15, 2012 1:03 am

Ramlog is nice. Wasn't aware of a prebuild package to do that !
If you didn't care about logs, you can just mount /var/log as a ramdisk
add this line in /etc/fstab

Code: Select all

tmpfs /var/log tmpfs defaults 0 0
My Blog - http://www.sirlagz.net
Visit my blog for Tips, Tricks, Guides and More !
WiFi Issues ? Have a look at this post ! http://www.raspberrypi.org/phpBB3/viewtopic.php?f=28&t=44044

User avatar
kspn
Posts: 68
Joined: Mon Jan 16, 2012 9:52 pm
Location: Melbourne

Re: Log files & SD Card wear

Wed Aug 15, 2012 1:37 am

When I get a chance I think I will try out RAMLog, I am interested in keeping the logs between boots and it looks to be possible.

Running a webserver as well as various python scripts means that having the logs is useful.

Thanks for the tips.

I wonder if it would be worthwhile putting RAMLog (or something like it) into the 'official' installation Disk Image?
No Coffee, No Workee

Elect
Posts: 11
Joined: Tue Aug 07, 2012 7:48 am
Location: Netherlands

Re: Log files & SD Card wear

Wed Aug 15, 2012 6:50 am

Ramlogs works very well. Every day it syncs the logs to the SD card.

Return to “Advanced users”