SD card failure in Octopi. Need to add folders to log2ram setup

pi 3B, octopi stretch 0.15.1, OctoPrint 1.3.10,
Using Raspberry pi. SD cards wear out quickly. They have limited number of write operations before failing. Write operations of pi's linux logging and Octoprint logging wear it out quickly.

Installed the utility/ service log2ram extends life by putting linux log files in a RAM disk. Very nice utility. Need to do more.

Octoprint logs are kept in /user/pi/.octoprint/logs not /var/log with the other linux log files. log2ram is not setup to "buffer" this folder. Running
$ iostat -d 60 /mmcblk0
show writing to the SD card at about 200K per minute.
have to check back on the rate with octoprint stopped.

Being a 95% linux noob, I need help to get log2ram to "buffer" the octoprint logs. Either

  1. reconfigure octoprint to log to /var/log
  2. add /user/pi/.octoprint/logs to the log2ram setup

Thank you for reading, Mitch

For it's not an actual problem - more a feature, I moved it to the section Showcase.

Hello mitch,
I am running 2 pi’s with anything sync deamon. No corrupter sdcard in months now.
Maybee this is a better option?

Mvg, John

@msburko It might be as simple as:

  1. mv ~/.octoprint/logs ~/.octoprint/logs.save # rename the existing folder in-place
  2. sudo mkdir /var/log/octoprint.d # create a new place for the logs
  3. sudo chown pi:pi /var/log/octoprint.d # change the owner of the folder to pi
  4. ln -s /var/log/octoprint.d ~/.octoprint/logs # create a softlink to the new folder
  5. cp ~/.octoprint/logs.save/* /var/log/octoprint.d/. # copy the files over into the new folder

A better approach would be to mv the files rather than to copy them, preserving their timestamps.

You'd need to test this but it seems to meet your needs.


And then of course, there's always this: move the logs to a USB drive.

1 Like