Hacker News new | ask | show | jobs
by castratikron 2051 days ago
Where do you save the log on a reboot or power loss?
3 comments

I'm absolutely not an expert on this, but you ideally provide a sufficiently large amount of storage area, with a flash memory controller, that over the expected (20 year plus hopefully!) lifespan of the product, the amount of periodic daily writes can be evenly distributed, and will not exceed the individual cell write lifespan.

Some people who have intentionally done torture test writes on consumer grade SSDs have discovered the actual cumulative TB writes that a $50 to $100 SSD will take before ultimate failure. From back in 2015: https://techreport.com/review/27909/the-ssd-endurance-experi...

One drive failed at 700TB written. If you were to write 2GB per day in an industrial/embedded application nonstop for 20 years, that is considerably less data than 700TB.

With teslas that have a persistent LTE data connection for the car, you also have the option of doing something like 300KB of file upload per day to a remote server.

> If you were to write 2GB per day in an industrial/embedded application nonstop for 20 years, that is considerably less data than 700TB.

Specifically:

  $ units
  You have: 2GiB/day * 20yr
  You want: TiB
  * 14.267273
  You have: 2GiB/day * 20yr
  You want: 700TiB
  / 49.063334
14TB total, or about one fiftieth of your quota.
Either you attach dedicated storage for it or you send the logs elsewhere using a network-mounted /var/log or using a syslog daemon on another host.
I have a reverse-ssh tunnel + script to upload the logs to my home server on demand. If the MCU crashes or reboots unexpectedly, I would lose those logs.

Ironically, my system for downloading the logs writes them to an SD card on a raspberry pi.

Just stick a secondary USB drive in and do your log writes there. Then your SD card won't have the wear and tear.