cannot seem to disconnect power without losing all data on SD card

This is starting to get mildy infuriating. This is the 6th time my SD card has been corrupted and I need to rinstall octoprint from scratch.

I have a PI 3b and have octoprint installed on it, a couple of times the power cable has been knocked loose, I have had a power failure, and once I did a shutdown in the GUI, wated a few min then unplugged it. All of those times I have lost all data on the SD card, This time I synced with dropbox so I did not lose my timelapses, but I did lose my settings. This time I had to move my printer across the room, so I shut down in GUI, waited TEN minutes, then unplugged the micro usb cable. I plugged it into it's new home, and it wont boot up. 100$ says the Micro SD card is missing half the files on it.

Does anyone have this problem, how can I solve it?

I've had my printer for a year and I've never created a corrupted microSD on it.

I have, however, created a dead microSD from a stand-alone installation with a Pi camera and mjpg_streamer running on it. I wanted to put it into a newly-printed enclosure I'd just printed and just unplugged it while it was running. I had to actually replace the microSD card, it was so corrupted.

I will say that the microSD for that was as cheap as they come and could have been a recycled card that was given to me from a bad batch. That's certainly a possibility. But I learned my lesson that mjpg_streamer really wants to be nicely kill'd before powering it off.

I contracted for a local 3D printer manufacturer and they brought me a handful of these corrupted microSD cards to troubleshoot. Their combined collection of 4,000 end-users produced a fair number of corrupted images, btw.

Six corrupted microSD cards leads me to think that your Raspberry Pi's micro power connection is too loose. This is a common occurrence, btw. There was a whole batch of these that came in all with the same problem. Once the printer starts bouncing around, the power connection makes and breaks, leading to corruption. Get a hair tie, wrap that around itself once on the micro power cable then loop what's remaining around the Pi itself. Use two hair ties, why not?

Once you've troubleshot this down to a wonky power connection then try replacing the micro power cable until you find one that is a nice snug fit.

have you tried another pi? If you've done a proper shutdown and still lost data, I have a feeling that's not something octoprint has any control over, octoprint isn't an operating system, it's just a program that runs under raspbian (on the pi anyway, it can be run under any os). Sounds to me like you either have a bundle of cheap nasty SD cards, or a faulty pi / faulty sd socket.

Excellent answer.

I will try your suggestion of tryingnother power supply, and also trying to anchor it in so it does no move.

I think the micro usb adaptor is lso not providing enough power because I get undervoltage warnings.

I will also setup OP again, and force a disconnect in the power. If it does the same as it has before, I will change the SD Card. It is a class 10 as someone had suggested on reddit, however I am uncertain of the quality of it. It IS a kensington, and I know it's official (not a clone) maybe it was just from a bad batch.

I do not have access to another pi. I lost my 2+.

I will try anchoring toe power suppy, and changing the SD card. I just got home from work, and I don't even feel like fixing it now, I would like to make a way to daily backup my PI, because I've lost faith in turning it off.

I had the power connector fry on one of my 3b's. I didn't realize it until I tried to unplug it and it was melted together

I didn't bother with trying to use that connector again and just plugged it directly into the GPIO.

It's been working fine ever since

Then that's probably half your problem, make sure you use a good power supply and not one designed for charging phones. Also make sure you're using a good quality usb cable if it's a usb power supply, otherwise go with the official raspberry pi power supply.

It IS a kensington

Do you mean kingston?

1 Like

Undervoltage is undervoltage.

Anything digital going on inside a computer needs a solid reference point. Imagine a litmus test like: "Anything above 2.41 volts DC will be considered to be ON." Undervolt means that the power supply just brought less than 4.64 volts to a party where 5 volts is expected. The reference is now wrong and that's how everything is measured. Should a zero or a one be stored on the microSD card? The computer is confused sometimes.