public inbox for gentoo-embedded@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-embedded] crash proofing a system from power cutoffs
@ 2012-01-08 17:59 Kfir Lavi
  2012-01-08 19:33 ` Mike Frysinger
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Kfir Lavi @ 2012-01-08 17:59 UTC (permalink / raw
  To: gentoo-embedded

[-- Attachment #1: Type: text/plain, Size: 434 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 522 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [gentoo-embedded] crash proofing a system from power cutoffs
  2012-01-08 17:59 [gentoo-embedded] crash proofing a system from power cutoffs Kfir Lavi
@ 2012-01-08 19:33 ` Mike Frysinger
  2012-01-23 18:39 ` Ed W
  2012-01-23 18:55 ` Peter Stuge
  2 siblings, 0 replies; 4+ messages in thread
From: Mike Frysinger @ 2012-01-08 19:33 UTC (permalink / raw
  To: gentoo-embedded; +Cc: Kfir Lavi

[-- Attachment #1: Type: Text/Plain, Size: 833 bytes --]

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

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [gentoo-embedded] crash proofing a system from power cutoffs
  2012-01-08 17:59 [gentoo-embedded] crash proofing a system from power cutoffs Kfir Lavi
  2012-01-08 19:33 ` Mike Frysinger
@ 2012-01-23 18:39 ` Ed W
  2012-01-23 18:55 ` Peter Stuge
  2 siblings, 0 replies; 4+ messages in thread
From: Ed W @ 2012-01-23 18:39 UTC (permalink / raw
  To: gentoo-embedded


> 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



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [gentoo-embedded] crash proofing a system from power cutoffs
  2012-01-08 17:59 [gentoo-embedded] crash proofing a system from power cutoffs Kfir Lavi
  2012-01-08 19:33 ` Mike Frysinger
  2012-01-23 18:39 ` Ed W
@ 2012-01-23 18:55 ` Peter Stuge
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Stuge @ 2012-01-23 18:55 UTC (permalink / raw
  To: gentoo-embedded

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



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-01-23 19:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-08 17:59 [gentoo-embedded] crash proofing a system from power cutoffs Kfir Lavi
2012-01-08 19:33 ` Mike Frysinger
2012-01-23 18:39 ` Ed W
2012-01-23 18:55 ` Peter Stuge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox