Mailing List Archive

crash proofing a system from power cutoffs
Hi,
I'll need to crash proof a Gentoo system from electricity cutoffs.
I have a system with 8GB of flash drive.
I created a small system ~100mb as the target system.
I thought of creating 5 200mb paratitions of raid1. So 5 will be mirrored.
What do you think of this solution?

Do you have more ideas how to keep the system intact ?
I'm creating ext4 partitions, but would like to hear some opinions on that
fileystem.

Regards,
Kfir
Re: crash proofing a system from power cutoffs [ In reply to ]
On Sunday 08 January 2012 12:59:16 Kfir Lavi wrote:
> I'll need to crash proof a Gentoo system from electricity cutoffs.
> I have a system with 8GB of flash drive.
> I created a small system ~100mb as the target system.
> I thought of creating 5 200mb paratitions of raid1. So 5 will be mirrored.
> What do you think of this solution?
>
> Do you have more ideas how to keep the system intact ?
> I'm creating ext4 partitions, but would like to hear some opinions on that
> fileystem.

what is your flash tech exactly ? it's a USB thumb drive ?

the best way to avoid problems is:
- use read-only mounts wherever possible
- use tmpfs for all scratch space you don't care about (many logs fall into
this category with embedded devices)
- for the few places you do write to disk, make sure to fdatasync()
-mike
Re: crash proofing a system from power cutoffs [ In reply to ]
> I thought of creating 5 200mb paratitions of raid1. So 5 will be
> mirrored.
> What do you think of this solution?

I don't think it will help much... Sorry. Partial writes are partial writes

The main way you can kill flash drives is to power off while they are
doing an internal write. On many devices if you do this at the right
moment then the flash drive completely disappears and is completely gone
(not recoverable as far as I know, never can be used or data accessed
ever again...)

I believe some very new drives has small capacitors to finalise a write
if the power goes off suddenly, however, I think on everything else your
flash is likely toast... The issue is corruption of the internal flash
drive filesystem, NOT the filesystem that you create on top of that (I
have one dead flash drive and I think it may well have been killed by
this? Allegedly the latest SLC flash drives from PC Engines are somewhat
resistant to this problem...)

With regards to corrupting the user filesystem due to sudden power loss,
ie as per normal spinning drives, then yes, any journalling filesystem
seems like a good idea. Ext4 is chosen by google (albeit without a
journal...). XFS is an odd ball choice and may have massive write
amplification problems that I don't know about, but what is nice is that
it seems resiliant to corruption on powerloss and avoids a fsck step.
This is only "better" in the sense that it doesn't require user input
and for embedded, this may keep the device going longer between visits
from support... However, bottom line is that if the power goes off
during a write then at some point you loose data...


Good luck

Ed W
Re: crash proofing a system from power cutoffs [ In reply to ]
Kfir Lavi wrote:
> I'll need to crash proof a Gentoo system from electricity cutoffs.

Then you need backup power. There is no other solution.


> I have a system with 8GB of flash drive.

As others have indicated, the particular type of flash "drive" is
very significant, because the electronics between CPU and flash chip
is obviously in control of writing and caching. If you are using
anything other than an mtd interface then you have much worse odds of
being able to survive power loss.


> I created a small system ~100mb as the target system.
> I thought of creating 5 200mb paratitions of raid1. So 5 will be
> mirrored. What do you think of this solution?

RAID does nothing.


> Do you have more ideas how to keep the system intact ?

See above.


> I'm creating ext4 partitions, but would like to hear some opinions
> on that fileystem.

Without mtd you are in such a bad situation that it almost doesn't
matter what you do on top of the block device as long as it's
journalled.

Of course if all partitions are mounted ro then there is no problem.

If you need write then make sure to use mtd hardware and jffs2 or such.


//Peter
Re: crash proofing a system from power cutoffs [ In reply to ]
Hi

>> I have a system with 8GB of flash drive.
> As others have indicated, the particular type of flash "drive" is
> very significant, because the electronics between CPU and flash chip
> is obviously in control of writing and caching. If you are using
> anything other than an mtd interface then you have much worse odds of
> being able to survive power loss.
>

I found the PC Engines pages to be interesting:

This is how to corrupt some older cards which are NOT the ones they now
sell:
http://www.pcengines.ch/cfissue.htm

Some simple and honest notes on flash:
http://www.pcengines.ch/cfperf.htm

Although not stated above, I believe that the newer PC Engines flash
cards that they sell *might* be resistant to complete corruption on
sudden power-off? Probably worth asking them.

Also PCEngines prices appear extremely reasonable for what appears to be
decent SLC flash cards (by all means point me to something else on the
internet that is less than 3-5x the price?). Anyone else got any
comments on these cards?

Cheers

Ed W