FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo Embedded

 
 
LinkBack Thread Tools
 
Old 01-24-2012, 01:06 PM
Todd Goodman
 
Default quickpkg and PKG_INSTALL_MASK

* Joakim Tjernlund <joakim.tjernlund@transmode.se> [120124 02:18]:
> Ed W <lists@wildgooses.com> wrote on 2012/01/23 19:43:49:
[ .. ]
> > I'm doing something like this using aufs. The performance seems "not
> > bad", but you get a couple MB or so memory hit. (I'm using squashfs as
> > well, so unsure which causes the main memory increase).
>
> hmm, not sure how aufs would work out. One would like to permanently delete the

aufs is A Union FileSystem. You can have a RO "branch" (say SquashFS)
and a r/w "branch" (say JFFS2 or UBIFS.) When you write it will write
to the r/w branch and when you read it will read from the r/w branch if
it exists, else the r/o.

So, if you want to permanently delete the old software. Write it to the
filesystem r/w filesystem (initially or after you have the aufs mounts
mounted.) Then you can delete from the r/w filesystem and it's gone for
good.

> old sw at some point and I don't see how, perhaps I misunderstand something?
>
> How does aufs do w.r.t power cuts? We need a reliable FS w.r.t power cuts. In the
> past we have used JFFS2 on NOR flash and that has worked really well. Now
> we need to switch to NAND due to size requirements.

You still want to pick a r/w branch with a filesystem that handles power
cuts well. You can continue to use JFFS2.

[..]

Todd
 
Old 01-25-2012, 12:21 PM
Ed W
 
Default quickpkg and PKG_INSTALL_MASK

On 24/01/2012 14:06, Todd Goodman wrote:

* Joakim Tjernlund<joakim.tjernlund@transmode.se> [120124 02:18]:

Ed W<lists@wildgooses.com> wrote on 2012/01/23 19:43:49:

[ .. ]

I'm doing something like this using aufs. The performance seems "not
bad", but you get a couple MB or so memory hit. (I'm using squashfs as
well, so unsure which causes the main memory increase).

hmm, not sure how aufs would work out. One would like to permanently delete the

aufs is A Union FileSystem. You can have a RO "branch" (say SquashFS)
and a r/w "branch" (say JFFS2 or UBIFS.) When you write it will write
to the r/w branch and when you read it will read from the r/w branch if
it exists, else the r/o.

So, if you want to permanently delete the old software. Write it to the
filesystem r/w filesystem (initially or after you have the aufs mounts
mounted.) Then you can delete from the r/w filesystem and it's gone for
good.


Agreed. Just to augment that explanation:

- The RO branch would be at the bottom (can be multiple of these)
- The RW branch goes over the top (*can* be multiple of these, but one
is more normal)
- You can effectively delete stuff from the RO branches because Aufs has
the concept of "white out" files. So for all intents and purposes the
top RW layer can create any end result you like, including that of
completely masking out some lower layer
- With some knowledge of how the whiteout files work you can also "undo"
changes to the RO files. Eg directly mounting the RW layer and erasing
all files (from the RW layer) leaves you back with just the stacked RO
layers again. I find this helpful for development where I can basically
work live on the last released build and then by inspection the RW layer
has all the changes needed to apply to the next RO layer release!


I believe recent kernels also have a much simpler "Overlay Filesystem"
that has fewer features. Also the big alternative to aufs is Unionfs 2
- most distros use aufs, but both seem viable?



Finally note that you don't need to use aufs for the entire filesystem.
A common setup might be to use a bunch of bind mounts where you know you
don't need overlay features, eg /usr might be a bunch of overlays, /home
might be a bind mount to writeable storage, /var might be a ram drive
which is initialised from some fixed template, etc? In my case I have
an overlay over most things, but /usr/lib/modules is a bind mount to a
RO filesystem (you can't write to it), /home is mounted to my writeable
storage (not layered), the main OS dirs are layered and /var is a mess...



You still want to pick a r/w branch with a filesystem that handles power
cuts well. You can continue to use JFFS2.


Thought: Is there any evidence that one modern filesystem is better than
another with regards to sudden power removal? You probably need to
speak to filesystem experts at this point and define the kind of thing
you are trying to protect against? Sounds like you have raw flash
storage here, so that constrains your choices somewhat?


Just note that with aufs you can use quite a few filesystems for the
different layers. So for example you could have a base RW layer which
is a DM snapshot, overlaid with a loopback mount to a DVD iso, overlay
that with a squashfs, and finally overlay an Ext4 RW mount... (And of
course each of the RO layers might be stored on varied filesystems
themselves - check distributions such as Slax which allow you to overlay
a squashfs that is itself inside some loopback mounted file...)

http://aufs.sourceforge.net/aufs2/report/sq/

http://aufs.sourceforge.net/

I believe for most cheapo consumer flash storage where the underlying
flash filesystem isn't exposed, its quite susceptable to *complete*
failure with sudden poweroff? The issue is the invisible, underlying
flash filesystem gets corrupted during a partial write and that can be
the end of your flash drive - you don't even get to see it again to
recover from it... I don't believe partitioning protects you from this,
but of course separating read/write concerns to physically separate
devices would help? I presume this isn't what you are using though?



Good luck

Ed W
 
Old 01-26-2012, 10:11 AM
Joakim Tjernlund
 
Default quickpkg and PKG_INSTALL_MASK

Ed W <lists@wildgooses.com> wrote on 2012/01/25 14:21:25:

>
> On 24/01/2012 14:06, Todd Goodman wrote:
> > * Joakim Tjernlund<joakim.tjernlund@transmode.se> [120124 02:18]:
> >> Ed W<lists@wildgooses.com> wrote on 2012/01/23 19:43:49:
> > [ .. ]
> >>> I'm doing something like this using aufs. The performance seems "not
> >>> bad", but you get a couple MB or so memory hit. (I'm using squashfs as
> >>> well, so unsure which causes the main memory increase).
> >> hmm, not sure how aufs would work out. One would like to permanently delete the
> > aufs is A Union FileSystem. You can have a RO "branch" (say SquashFS)
> > and a r/w "branch" (say JFFS2 or UBIFS.) When you write it will write
> > to the r/w branch and when you read it will read from the r/w branch if
> > it exists, else the r/o.
> >
> > So, if you want to permanently delete the old software. Write it to the
> > filesystem r/w filesystem (initially or after you have the aufs mounts
> > mounted.) Then you can delete from the r/w filesystem and it's gone for
> > good.
>
> Agreed. Just to augment that explanation:

Sorry for the late reply, got sidetracked with high prio stuff.

>
> - The RO branch would be at the bottom (can be multiple of these)
> - The RW branch goes over the top (*can* be multiple of these, but one
> is more normal)
> - You can effectively delete stuff from the RO branches because Aufs has
> the concept of "white out" files. So for all intents and purposes the
> top RW layer can create any end result you like, including that of
> completely masking out some lower layer
> - With some knowledge of how the whiteout files work you can also "undo"
> changes to the RO files. Eg directly mounting the RW layer and erasing
> all files (from the RW layer) leaves you back with just the stacked RO
> layers again. I find this helpful for development where I can basically
> work live on the last released build and then by inspection the RW layer
> has all the changes needed to apply to the next RO layer release!

When you update the RO layer you will be back to a single copy, the previous
release which is only in the overlay is gone, right?

It also implies 2 different SW update methods, one for updating the overlay
copy and one for updating the RO layer.

For development it works well though.

>
> I believe recent kernels also have a much simpler "Overlay Filesystem"
> that has fewer features. Also the big alternative to aufs is Unionfs 2
> - most distros use aufs, but both seem viable?

Dunno, I haven't tried any overlay FS yet.

>
>
> Finally note that you don't need to use aufs for the entire filesystem.
> A common setup might be to use a bunch of bind mounts where you know you
> don't need overlay features, eg /usr might be a bunch of overlays, /home
> might be a bind mount to writeable storage, /var might be a ram drive
> which is initialised from some fixed template, etc? In my case I have
> an overlay over most things, but /usr/lib/modules is a bind mount to a
> RO filesystem (you can't write to it), /home is mounted to my writeable
> storage (not layered), the main OS dirs are layered and /var is a mess...
>
> > You still want to pick a r/w branch with a filesystem that handles power
> > cuts well. You can continue to use JFFS2.
>
> Thought: Is there any evidence that one modern filesystem is better than
> another with regards to sudden power removal? You probably need to
> speak to filesystem experts at this point and define the kind of thing
> you are trying to protect against? Sounds like you have raw flash
> storage here, so that constrains your choices somewhat?

AFAIK, only FSes which are designed for flash(JFFS2, UBIFS, YAFFS etc. )
are safe w.r.t power cuts.

>
> Just note that with aufs you can use quite a few filesystems for the
> different layers. So for example you could have a base RW layer which
> is a DM snapshot, overlaid with a loopback mount to a DVD iso, overlay
> that with a squashfs, and finally overlay an Ext4 RW mount... (And of
> course each of the RO layers might be stored on varied filesystems
> themselves - check distributions such as Slax which allow you to overlay
> a squashfs that is itself inside some loopback mounted file...)

hmm, DM snapshots might be something. Have to look closer on that.

> http://aufs.sourceforge.net/aufs2/report/sq/
>
> http://aufs.sourceforge.net/
>
> I believe for most cheapo consumer flash storage where the underlying
> flash filesystem isn't exposed, its quite susceptable to *complete*
> failure with sudden poweroff? The issue is the invisible, underlying
> flash filesystem gets corrupted during a partial write and that can be
> the end of your flash drive - you don't even get to see it again to
> recover from it... I don't believe partitioning protects you from this,
> but of course separating read/write concerns to physically separate
> devices would help? I presume this isn't what you are using though?

We are not using NAND flash yet but our next product will. I do have the
impression that any block emulating device such as SSD are unreliable
w.r.t power cuts. I would love to be proven wrong though

Jocke
 
Old 01-26-2012, 12:30 PM
Todd Goodman
 
Default quickpkg and PKG_INSTALL_MASK

* Joakim Tjernlund <joakim.tjernlund@transmode.se> [120126 05:38]:
[..]
>
> When you update the RO layer you will be back to a single copy, the previous
> release which is only in the overlay is gone, right?

That's up to you. You can manage your updates however you want. For
example, you can have your RO layer loop mounted out of a release image
and have two (or more) different RW areas depending on which image
you're running. That can allow you to fallback from an update fairly
easily.

>
> It also implies 2 different SW update methods, one for updating the overlay
> copy and one for updating the RO layer.

Well, you probably will have an initramfs to set up the aufs. As part
of the initramfs you can do whatever you have to for the update. If you
have things on the RW layer that should be carried over you can leave
them if you mount the same RW filesystem with the new RO layer or you
can copy them to a new RW filesystem if you want them to move forwards
but still want a separate RW filesystem for each image to allow easy
fallback. It's really up to how you want to manage it and how much RW
you need to go forwards with the update (and where it is on the
filesystem too.)

[..]
> AFAIK, only FSes which are designed for flash(JFFS2, UBIFS, YAFFS etc. )
> are safe w.r.t power cuts.

Yes, that's certainly been my experience.

[..]
>
> We are not using NAND flash yet but our next product will. I do have the
> impression that any block emulating device such as SSD are unreliable
> w.r.t power cuts. I would love to be proven wrong though
>
> Jocke

I've used NOR flash with aufs and a RO loop mounted root filesystem from
within a release image and UBIFS RW filesystem.

It worked well.

I've used NOR with JFFS2 before as well and had some issues. Those may
have been bugs in the JFFS2 implementation I used though.

Todd
 
Old 01-26-2012, 01:59 PM
Peter Stuge
 
Default quickpkg and PKG_INSTALL_MASK

Joakim Tjernlund wrote:
> > > You still want to pick a r/w branch with a filesystem that
> > > handles power cuts well. You can continue to use JFFS2.
> >
> > Thought: Is there any evidence that one modern filesystem is better
> > than another with regards to sudden power removal? You probably
> > need to speak to filesystem experts at this point and define the
> > kind of thing you are trying to protect against? Sounds like you
> > have raw flash storage here, so that constrains your choices
> > somewhat?

In fact, having "raw" flash storage is the *only* way to have *any*
chance of completely reliable handling of power outage.


> AFAIK, only FSes which are designed for flash(JFFS2, UBIFS, YAFFS etc. )
> are safe w.r.t power cuts.

It's not only about the filesystem, it is also critical that the
kernel is actually in charge of writing to flash. This means that
if you are not using an mtd based device, you can never have perfect
reliability, regardless of what your filesystem promises.


> We are not using NAND flash yet but our next product will.

NAND or NOR is not important - mtd block device is.


> I do have the impression that any block emulating device such as
> SSD are unreliable w.r.t power cuts. I would love to be proven
> wrong though

Supposedly, Intel SSDs never report write completed before flash has
actually been updated. Good luck verifying that.

Everyone else buffers writes. The Samsung 830 series has 256MB of
SDRAM, and their multicore ARM controller handles the magic
buffering. Samsung 830 is built entirely by Samsung from Samsung
parts. All manufacturers besides Intel and Samsung use a mishmash
of components and firmware in their SSD products, and all do magic
buffering.


//Peter
 
Old 01-27-2012, 05:15 PM
Ed W
 
Default quickpkg and PKG_INSTALL_MASK

On 26/01/2012 13:30, Todd Goodman wrote:

* Joakim Tjernlund<joakim.tjernlund@transmode.se> [120126 05:38]:
[..]

When you update the RO layer you will be back to a single copy, the previous
release which is only in the overlay is gone, right?

That's up to you. You can manage your updates however you want. For
example, you can have your RO layer loop mounted out of a release image
and have two (or more) different RW areas depending on which image
you're running. That can allow you to fallback from an update fairly
easily.


Indeed.

So for example I am trying something a bit like the Slax distro:
- I produce a base distro that will hopefully change very slowly. This
has the minimal software for any other base (uclibc, busybox, few tools ...)
- I produce a faster moving update that has real software on it (eg I
need Dovecot/Postfix, some other stuff)
- I have a final overlay with "my" software on, ie integration stuff
(this is the web apps, very specific stuff to this build, etc. note
this may turn out to be a wrong move - considering combining this with
the step above...)
- I bind mount some other stuff over the top of this, eg my kernel
/lib/modules is in a squashfs and bind mounted into this. Therefore I
can update the kernel separately to all of the above.



The goal of this chain was to minimise the *size* of updates. Your goal
might be different and hence have fewer/more layers. I also considered
the possibility of "shims" between the faster moving layers above. The
motivation was to be able to do little micro updates without rebuilding
a whole layer (my layers are perhaps 10MB+ and the users have expensive
and slow bandwidth, so being able to ship a 50KB shim to fix something
is better than a 10MB module - not convinced yet, but sharing the idea...)


Don't feel this is right for you. Just highlighting how you could use
an overlay filesystem. Also see the Slax distribution for an example
which takes this to extremes (software installs are just overlay modules
to a basic core system - very clever)


Good luck

Ed W
 
Old 01-27-2012, 05:27 PM
Ed W
 
Default quickpkg and PKG_INSTALL_MASK

On 26/01/2012 14:59, Peter Stuge wrote:



I do have the impression that any block emulating device such as
SSD are unreliable w.r.t power cuts. I would love to be proven
wrong though



Supposedly, Intel SSDs never report write completed before flash has
actually been updated. Good luck verifying that.

Everyone else buffers writes. The Samsung 830 series has 256MB of
SDRAM, and their multicore ARM controller handles the magic
buffering. Samsung 830 is built entirely by Samsung from Samsung
parts. All manufacturers besides Intel and Samsung use a mishmash
of components and firmware in their SSD products, and all do magic
buffering.



I can't find a reference right now, but I am under the impression
that the more expensive "enterprise" SSD modules now have some
battery backup onboard to allow writes to complete in sudden power
down situations?* I read recently of one consumer report (probably
on Anand tech, but can't find it now...) which had also been fitted
with some kind of supercap to handle unexpected powerloss



(Update, google "SSD supercap" - seems like some of the higher end
Sandforce boards have such a thing, and on skimming it is implied
that the Vertex3 might have such a thing?)



I also found this paper which seemed interesting:

*** http://cseweb.ucsd.edu/users/swanson/papers/DAC2011PowerCut.pdf





Seems like it's a rocky road ahead...



Cheers



Ed W





P.S.* I think this phenomena explains what surely everyone here has
experienced, that if you rip out a USB flash drive while it's still
writing then every so often the whole drive just disappears (and
stays dead)?* Also I have killed one CF almost certainly due to a
sudden reboot (but it was the design that has since been recalled by
PCEngines), and a few others that on reflection might have had a
sudden powerdown in a camera or while removing pictures from the
camera flash card...* Read random amazon reviews of flash drives and
there are always a bunch of people who post when their drive totally
fails while it's new - again my bet would be many of these would be
explained by sudden unplugs during write...
 

Thread Tools




All times are GMT. The time now is 12:18 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org