jmb2341
Posts: 7
Joined: Sun Aug 24, 2014 8:26 pm

Flash Storage and Data Corruption

Tue Jul 14, 2015 5:46 pm

Hello,

Is external flash storage generally more unreliable than on board flash storage?

Arduinos seem to have no problem with data corruption during power fluctuation, is this generally because they are not storing data in more permanent storage?

As far as I know an Arduino uses Flash memory to store your program, SRAM to temporarily store readings/variables, and a small amount of EEPROM for memory storage during power failure.

A RPi B+ has 512MB of SDRAM and a MicroSD slot.

A RPi Compute module has 512MB or SDRAM and 4GB of eMMC flash storage.

Is on board eMMC more reliable than an SD card?

I know that there are various ways to lengthen the life of a SD card in an RPi,

< http://www.zdnet.com/article/raspberry- ... e-sd-card/ >
< http://raspberrypi.stackexchange.com/qu ... rd/186#186 >

but would a different type of storage solve the problem of easily corruptible storage? Is the compute module or BeagleBone Black's method of data storage more reliable?

Heater
Posts: 16092
Joined: Tue Jul 17, 2012 3:02 pm

Re: Flash Storage and Data Corruption

Tue Jul 14, 2015 6:33 pm

If you are writing to the storage that holds your operating system eventually it will fail to boot and run correctly. Either:

1) The media is written to past it write cycle limit - FAIL.

2) Power cycling whilst writing will corrupt the OS - FAIL.

3) Potentially any software running as root may have bugs that cause it to write over your OS or application files. - FAIL.

Clearly it's better not to write to your important file space. Better still make it so that it is mounted read-only so that nothing running can write to it ever.

As for internal vs external storage, clearly FLASH chips on the board are a lot more reliable than FLASH chips in an external SD card or USB stick or whatever. At least all that interconnect is out of the equation.
Memory in C++ is a leaky abstraction .

jmb2341
Posts: 7
Joined: Sun Aug 24, 2014 8:26 pm

Re: Flash Storage and Data Corruption

Tue Jul 14, 2015 6:53 pm

Hi Heater,

Thanks for the reply.

So if you had, for example, a compute module and you made the eMMC flash read only it could be as robust as an Arduino?

If you needed to store data the best way I see is to use an external flash drive that can fail without the main operating functions totally failing. I say external usb for the data store because it would be easier to replace. What do you think?

User avatar
rpdom
Posts: 17275
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Flash Storage and Data Corruption

Tue Jul 14, 2015 7:04 pm

jmb2341 wrote:Hi Heater,

Thanks for the reply.

So if you had, for example, a compute module and you made the eMMC flash read only it could be as robust as an Arduino?

If you needed to store data the best way I see is to use an external flash drive that can fail without the main operating functions totally failing. I say external usb for the data store because it would be easier to replace. What do you think?
You certainly could do that with the CM. Many people do similar with their Pi (boot file system on SD very rarely gets written to, main file system on USB stick or disk for general storage). It does seem more reliable that way.

Heater
Posts: 16092
Joined: Tue Jul 17, 2012 3:02 pm

Re: Flash Storage and Data Corruption

Tue Jul 14, 2015 11:05 pm

@jmb2341,

I would certainly go for a read only root file system. My approach is never to store anything locally on the Pi. All my Pi are able to reach the internet so any data that needs saving is sent out over the net to a server some place. If you must store data locally then I guess a USB stick is a good option, easily replaceable as you say.

There are instructions for creating a read only root fs system here: https://wiki.debian.org/ReadonlyRoot and I just noticed someone has made some Pi specific instructions here: http://blog.gegg.us/2014/03/a-raspbian- ... -fs-howto/

I have no idea if that makes things as robust as an Arduino. What if an SD card is more sensitive to temperature than the Arduino's internal FLASH? What about mechanical robustness of the SD card holder? And so on.

The CM may be a more robust approach. I have no idea.

@rpdom,

Statements like "It does seem more reliable that way." are meaningless. How reliable? Is that down to 50% chance of failure in a year from 100% ? Or perhaps 10% down to 5%? Or are we getting down to the 0.01% chance of failure?
Memory in C++ is a leaky abstraction .

Return to “General discussion”