From: "Theodore Ts'o" <tytso@mit.edu>
To: "Alan C. Assis" <acassis@gmail.com>
Cc: "Bjørn Forsman" <bjorn.forsman@gmail.com>,
"Kai Tomerius" <kai@tomerius.de>,
linux-embedded@vger.kernel.org,
"Ext4 Developers List" <linux-ext4@vger.kernel.org>,
dm-devel@redhat.com
Subject: Re: File system robustness
Date: Tue, 18 Jul 2023 17:32:12 -0400 [thread overview]
Message-ID: <20230718213212.GE3842864@mit.edu> (raw)
In-Reply-To: <CAG4Y6eTN1XbZ_jAdX+t2mkEN=KoNOqprrCqtX0BVfaH6AxkdtQ@mail.gmail.com>
On Tue, Jul 18, 2023 at 10:04:55AM -0300, Alan C. Assis wrote:
>
> You are right, for NAND there is an old (but gold) presentation here:
>
> https://elinux.org/images/7/7e/ELC2009-FlashFS-Toshiba.pdf
>
> UBIFS and YAFFS2 are the way to go.
This presentation is specifically talking about flash devices that do
not have a flash translation layer (that is, they are using the MTD
interface).
There are multiple kinds of flash devices, that can be exported via
different interfaces: MTD, USB Storage, eMMC, UFS, SATA, SCSI, NVMe,
etc. There are also differences in terms of the sophistication of the
Flash Translation Layer in terms of how powerful is the
microcontroller, how much memory and persistant storage for flash
metadata is available to the FTL, etc.
F2FS is a good choice for "low end flash", especially those flash
devices that use a very simplistic mapping between LBA (block/sector
numbers) and the physical flash to be used, and may have a very
limited number of flash blocks that can be open for modification at a
time. For more sophiscated flash storage devices (e.g., SSD's and
higher end flash devices), this consideration won't matter, and then
the best file system to use will be very dependant on your workload.
In answer to Kai's original question, the setup that was described
should be fine --- assuming high quality hardware. There are some
flash devices that designed to handle power failures correctly; which
is to say, if power is cut suddenly, the data used by the Flash
Translation Layer can be corrupted, in which case data written months
or years ago (not just recent data) could be lost. There have been
horror stories about wedding photographers who dropped their camera,
and the SD Card came shooting out, and *all* of the data that was shot
on some couple's special day was completely *gone*.
Assuming that you have valid, power drop safe hardware, running fsck
after a power cut is not necessary, at least as far as file system
consistency is concerned. If you have badly written userspace
application code, then all bets can be off. For example, consider the
following sequence of events:
1) An application like Tuxracer truncates the top-ten score file
2) It then writes a new top-ten score file
3) <Fail to call fsync, or write the file to a foo.new and then
rename on top of the old version of the file>
4) Ut then closes the Open GL library, triggering a bug in the cruddy
proprietary binary-only kernel module video driver,
leading to an immediate system crash.
5) Complain to the file system developers that users' top-ten score
file was lost, and what are the file system developers going to
do about it?
6) File system developers start creating T-shirts saying that what userspace
applications really are asking for is a new open(2) flag, O_PONIES[1]
[1] https://blahg.josefsipek.net/?p=364
So when you talk about overall system robustness, you need robust
hardware, you need a robust file aystem, you need to use the file
system correctly, and you have robust userspace applications.
If you get it all right, you'll be fine. On the other hand, if you
have crappy hardware (such as might be found for cheap in the checkout
counter of the local Micro Center, or in a back alley vendor in
Shenzhen, China), or if you do something like misconfigure the file
system such as using the "nobarrier" mount option "to speed things
up", or if you have applications that update files in an unsafe
manner, then you will have problems.
Welcome to systems engineering. :-)
- Ted
next prev parent reply other threads:[~2023-07-18 21:32 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20230717075035.GA9549@tomerius.de>
2023-07-17 9:08 ` File system robustness Geert Uytterhoeven
[not found] ` <CAG4Y6eTU=WsTaSowjkKT-snuvZwqWqnH3cdgGoCkToH02qEkgg@mail.gmail.com>
[not found] ` <20230718053017.GB6042@tomerius.de>
2023-07-18 12:56 ` Alan C. Assis
[not found] ` <CAEYzJUGC8Yj1dQGsLADT+pB-mkac0TAC-typAORtX7SQ1kVt+g@mail.gmail.com>
2023-07-18 13:04 ` Alan C. Assis
2023-07-18 14:47 ` Chris
2023-07-18 21:32 ` Theodore Ts'o [this message]
2023-07-19 6:22 ` Martin Steigerwald
2023-07-20 4:20 ` Theodore Ts'o
2023-07-20 7:55 ` Nobarrier mount option (was: Re: File system robustness) Martin Steigerwald
2023-07-21 13:35 ` Theodore Ts'o
2023-07-21 14:51 ` Martin Steigerwald
2023-07-19 10:51 ` File system robustness Kai Tomerius
2023-07-20 4:41 ` Theodore Ts'o
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230718213212.GE3842864@mit.edu \
--to=tytso@mit.edu \
--cc=acassis@gmail.com \
--cc=bjorn.forsman@gmail.com \
--cc=dm-devel@redhat.com \
--cc=kai@tomerius.de \
--cc=linux-embedded@vger.kernel.org \
--cc=linux-ext4@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).