I have a couple of Raspberry Pi 4s now running docker, and some lightweight-usage containers for Flask and PostgreSQL. They run 24x7, and it's absolutely fine - apart from what appears to be repeated OS corruption possibly because the SD cards fail. When I try to reformat, the cards are not visible in another OS.

What would make the biggest difference? Switching off when not needed. Moving everything to SSD via a USB enclosure to minimise SD card usage apart from boot? Both!? Better cards (I use Kingston) Anything else?

I use the Official RPI power supplies.

The main use for the database server is to log event messages, so perhaps - on reflection - I show just write to a log file on the Flask containers.

  • 1
    There are special high endurance cards available. Alternatively buy a bigger card and leave half of the space unpartitioned (never overwrite this part). Also postgresql can be configured to minimize writes, check e.g. the documentation about the Write Ahead Log WAL.
    – Robert
    Oct 18, 2020 at 19:47
  • What power supply are you using? Do you ever see the lighting symbol?
    – CoderMike
    Oct 18, 2020 at 20:47
  • Have you tried fsck to gain some visibility into what's happening? Consider this - the log files may show trends over time.
    – Seamus
    Oct 18, 2020 at 22:01


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.