Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Anyone know what the best practice is to guard against corruption on your SD card or your SSD if your home power goes out and your Raspberry Pi power-cycles unexpectedly (outside of just getting a UPS?)

I've had a previous RPI SD card get corrupted this way and I've been hesitant to do anything useful with home-hosting on one since I had that problem.



Get an SD card specifically labeled "high endurance." They're a tad bit more expensive, but do work.

Corruption has always been an issue with using standard SD cards as a boot system. It's just something these cards were never meant to do. I run multiple Pis at home, one of them as a scraper/site hosting/MariaDB/Wireguard. Power outages would almost always corrupt the file system, and a few times, damage the SD card. Once I switched to high endurance cards, I haven't had a problem.


I have a datalogger based on RaPi running since around 2 years. It writes every 5 minutes more or less 25 bytes to a file on a standard SD card. I have frequent black outs (and maybe brown outs, too, but never investigated this), and I never had problems with FS corruption.


The only things I can think of do involve a ups. There are battery banks that support pass through charging but I’m not sure if you’re supposed to use that constantly. A low capacity power strip style ups seems like the next best. Or don’t use a pi at all - if you have an old laptop that you don’t use, that could be the server and it has its own built in ups.

Sorry I don’t know that I’m being helpful here. I had the same issue and just ended up with an ups - but I also ended up plugging my networking rack into it (router, cable modem, switch, nas) as well. We’ve only had one real outage since I set this up, but it kept my network alive for 90 minutes or so and then the power came back up.


Enable read-only overlay for your rootfs and make your /boot readonly. Just use raspi-config, and go into performance options.

There are some gotchas - everything you write after that goes to a tmpfs. Meaning it starts cutting into your available RAM. So this overlay is only really useful if you are using the high-memory variants like the 4GB/8GB RPI4. With the 1GB Pi variants, this gets painful.

Alternatively, You could setup a cron job to reboot every night thus clearing the tmpfs.

Do remember to disable the overlay (and make /boot rw) every few weeks to apply updates.


A good alternative is to use a similar SBC with eMMC module support, such as one of the ODROIDs


I have a Toradex Colibri with 4GB of eMMC formatted with ext4. As part of a system test I've been cutting power on it every 12 hours for two years now and haven't lost a byte.


Backup, backup, backup.

Also test your backups.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: