1

I want to be able to just pull the power on my raspberry pi project.

I am aware that sd cards don't like that. Is it possible to use some kind of other persistent storage such as a flash drive or some kind of sd card adapter that would allow me to be able to just unplug the power without worrying about data corruption, as is the case with the pico for example?

8
  • 1
    If you pull the power on any computer you risk corruption. Most expensive computers have circuitry to gracefully shut down (which costs more than a Pi). It is possible to add such hardware to a Pi. Frankly the risk of corruption on a Pi is greatly exaggerated. Over 10 years with more power failures than I can remember I have never corrupted an SD Card. I often have to cut power. SD do wear out and operator error is more likely to corrupt OS.
    – Milliways
    Jul 6, 2023 at 11:52
  • 2
    @Milliways well that is quite surprising to me. We're using a raspberry pi in a commercial product and after a few years we hardly have any units that haven't had their sd card corrupted due to mains power outages.
    – php_nub_qq
    Jul 6, 2023 at 12:06
  • 1
    @php_nub_qq I am the same and concur. Millways does not know what he is talking about Jul 6, 2023 at 13:06
  • @php_nub_qq I use a UPS. Never had any problems since. Jul 6, 2023 at 13:07
  • 1
    @CoderMike I've read in another question which I can't find now, that it doesn't matter how the partition is mounted, the way SD cards work data can even get corrupted on unmounted partitions.
    – php_nub_qq
    Jul 6, 2023 at 15:20

1 Answer 1

1

You can't make the entire RPi "hot unpluggable" by dealing only with the SD card.

You're (presumably) using the ext4 filesystem; this helps prevent corruption on your SD card because it's a journaled filesystem. But it can't do the job by itself. If the processor loses power it can't complete all of the filesystem chores it may be involved in executing.

This realization leads us to next consider an Uninterrubtible Power Supply, which may get you closer to what you seem to be after. There are commercially-available UPS "HATS" available (for example) that may serve your needs. Since these are usually battery-powered, you may wish to add software logic and/or additional hardware to terminate (halt) RPi processing, and then power down the UPS and RPi to avoid exhausing batteries.

Your "hot unpluggable" idea is interesting, and not without applications, but it will require some effort to realize it.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.