Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.arch.embedded > #30737

Re: Shutdown behavior and flash storage devices

From Dimiter_Popoff <dp@tgi-sci.com>
Newsgroups comp.arch.embedded
Subject Re: Shutdown behavior and flash storage devices
Date 2021-07-25 22:51 +0300
Organization TGI
Message-ID <sdkfcj$ddf$1@dont-email.me> (permalink)
References <sdhb29$ibh$1@gioia.aioe.org> <sdidmc$d9c$1@dont-email.me> <sdjmlo$4ji$1@gioia.aioe.org>

Show all headers | View raw


On 7/25/2021 15:49, Dave Nadler wrote:
> On 7/24/2021 9:10 PM, Don Y wrote:
>>> So, how do you avoid this kind of corruption in your designs?
>>
>> Two (transient) copies of each "chunk" of data.  Update the second
>> copy (on or before impending power fail).  When complete, toggle
>> a pointer to reference it as the most recent (assuming you don't
>> have metadata that automatically provides that sort of information).
>>
>> The "first" copy can now be removed and its space reallocated to
>> some other "second copy"
>>
>> Then, move on to the next "chunk".  Design your algorithms so that
>> you can tolerate some chunks being "stale" (not updated in time)
>> wrt the others.
> 
> Don, I don't think that works. The entire contents of the volume can
> be corrupted if power is removed during wear-leveling operations that 
> are invisible to the host OS. And I guess you are assuming no file 
> system is in use (because file system internals would still get corrupted)?
> 

If you have no knowledge of how the flash medium is written - which
would normally be the case with USB sticks or SD cards etc. - the most
efficient way to mitigate data loss probability is to do as much
write cacheing as you can afford at system level. Of course again
you will be prone to data loss on unexpected power loss but updating
the write cache will be done at (much) longer intervals and in
relatively brief bursts, thus the probability to be hit gets lower.
The rest can only be got rid of by having large enough caps on
the power supply and an early warning that power has been lost
(usually at the input of the stepdowns and you are running on fumes.

Of course you can employ various strategies to mimick flash drive
behaviour at a higher level, Don suggested one, Kent also did,
but these mean having different drivers for different media and
all the consequences of that. I prefer to talk to standard SCSI
or ATA behaving things and leave it to them to handle their
unique specifics. [I remember how I *had to* introduce write
cacheing at system level, in the mid 90-s I started to do backups
under DPS to magneto-optical devices; early days DPS would
simply update its CAT (Cluster Allocation Table) every time
it got modifier and these sectors got corrupted before the backup
would finish.... :-) ].

Dimiter

======================================================
Dimiter Popoff, TGI             http://www.tgi-sci.com
======================================================
http://www.flickr.com/photos/didi_tgi/

Back to comp.arch.embedded | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Shutdown behavior and flash storage devices Dave Nadler <drn@nadler.com> - 2021-07-24 11:19 -0400
  Re: Shutdown behavior and flash storage devices Theo <theom+news@chiark.greenend.org.uk> - 2021-07-24 16:37 +0100
  Re: Shutdown behavior and flash storage devices Don Y <blockedofcourse@foo.invalid> - 2021-07-24 18:10 -0700
    Re: Shutdown behavior and flash storage devices Dimiter_Popoff <dp@tgi-sci.com> - 2021-07-25 14:18 +0300
      Re: Shutdown behavior and flash storage devices Don Y <blockedofcourse@foo.invalid> - 2021-07-25 09:20 -0700
    Re: Shutdown behavior and flash storage devices Dave Nadler <drn@nadler.com> - 2021-07-25 08:49 -0400
      Re: Shutdown behavior and flash storage devices Don Y <blockedofcourse@foo.invalid> - 2021-07-25 09:30 -0700
      Re: Shutdown behavior and flash storage devices Dimiter_Popoff <dp@tgi-sci.com> - 2021-07-25 22:51 +0300
        Re: Shutdown behavior and flash storage devices Don Y <blockedofcourse@foo.invalid> - 2021-07-25 13:27 -0700
          Re: Shutdown behavior and flash storage devices Dimiter_Popoff <dp@tgi-sci.com> - 2021-07-26 00:00 +0300
            Re: Shutdown behavior and flash storage devices Don Y <blockedofcourse@foo.invalid> - 2021-07-25 17:35 -0700
  Re: Shutdown behavior and flash storage devices kegs@provalid.com (Kent Dickey) - 2021-07-25 13:53 -0500
    Re: Shutdown behavior and flash storage devices Don Y <blockedofcourse@foo.invalid> - 2021-07-25 13:20 -0700
  Re: Shutdown behavior and flash storage devices Jaded Hobo <badboy@heaven.org> - 2021-07-27 19:44 +0200
    Re: Shutdown behavior and flash storage devices Don Y <blockedofcourse@foo.invalid> - 2021-07-27 11:27 -0700

csiph-web