The hardware problem is that you're switching the power to the pi every minute.sethbollinger wrote:
We have 20 devices on a power controller that we're power cycling via script about every minute. As stated in the previous post, they will fail in what appears to be a low level way (SD card FTL) after ~4 hours. I've seen a bunch of nulls appended to files in /etc, which I assume happens before the low level failure. I'm not writing to those files _ever_, so I expect them to be coherent.
I've run this test on non-dpi devices running jffs2 on raw flash and have _never_ seen this type of corruption. It seems like a hardware/firmware problem to me.
yes there is - use a small lipo battery that will sense when you get a power fail and gracefully shutdown . if you are power cycling every 60 secs it is going to kill somethingsethbollinger wrote:We see this problem using f2fs as well. This is a log based journaling FS (as you probably know).
This makes me pretty sad as there's no way that we can make certain our customers don't power cycle the device. So you're saying that pretty much every one of the millions of devices out there will become corrupt if you power cycle them at the wrong time? Sounds like a good reason to not use SD cards as the main storage...
I will set up a test using another piece of hardware running from an SD card.
Code: Select all
Dec 17 10:52:25 raspberrypi kernel: [480802.908015] mmcblk0: error -110 transferring data, sector 3211435, nr 5, cmd response 0x900, card status 0x200b00 Dec 17 10:52:25 raspberrypi kernel: [480802.908049] end_request: I/O error, dev mmcblk0, sector 3211435
In certain applications, SD card would be inappropriate simply because of the way it works. But for the main use case for the Raspi, it works fine. It's cheap, easily changed from one card to another, and for most people, SD card corruption will never happen, simply because they are not turning their devices on and off all the time. It's a percentage likelihood thing. Most people simply do not turn their devices on/off frequently enough to ever break them.sethbollinger wrote:This makes me pretty sad as there's no way that we can make certain our customers don't power cycle the device. So you're saying that pretty much every one of the millions of devices out there will become corrupt if you power cycle them at the wrong time? Sounds like a good reason to not use SD cards as the main storage...
Code: Select all
#!/bin/bash # # write zeros to all free sectors then remove the files. # # clean the apt cache first # # run from the disk you want to zeroise # sudo apt-get clean dd if=/dev/zero of=zero.small.file bs=1024 count=102400 dd if=/dev/zero of=zero.file bs=1024 sync ; sleep 60 ; sync rm zero.small.file rm zero.file
Heater,Heater wrote: Basically by doing that you are telling the card that all sectors (blocks?) are now full of data. Which happens to be all zeros. The SD cards controller now cannot use those blocks to perform any wear levelling it may want to do.
I think SSDs are similar. If they have 256GiB of NAND, they present a user-visible size of say 240GB decimal, which is a difference of 12.7%.gsh wrote:For SSD this is all different because they don't have a magic 10% hidden away so it is important to identify the blocks that are known to be empty and of course it makes sense because the OS knows which blocks are used and which are not!