by londons_explore · 3y ago · 0 comments
Specifically, robustness to everything around them not performing as required. For example, imagine an evil SSD which had a 1% chance of rolling a sector back to a previous version, a 1% chance of saying a write failed when it didn't, a 1% chance of writing data to the wrong sector number, a 1% chance of flipping some bits in the written data, and a 1% chance of disconnecting and reconnecting a few seconds later.
Real SSD's have bugs that make them do all of these things.
Given this evil SSD, I want to know how long the filesystem can keep going serving the users usecase.
nbdkit memory 10G --filter=error error-rate=1%
... and then nbd-loop-mount that as a block device and create your filesystem on top.Notes:
We're working on making a ublk interface to nbdkit plugins so the loop mount wouldn't be needed.
There are actually better ways to use the error filter, such as triggering it from a file, see the manual: https://www.libguestfs.org/nbdkit-error-filter.1.html
It's an interesting idea to have an "evil" filter that flips bits at random. I might write that!
[0]: https://www.kernel.org/doc/html/latest/admin-guide/device-ma...
The advantage is you can write plugins as regular code in lots of different programming languages, with a stable API and ABI: https://www.libguestfs.org/nbdkit.1.html So it's a lot easier to experiment or write plugins for odd devices.
Also our sparse RAM disk supports huge disks (up to 16 exabytes IIRC, 2^63-1 bytes whatever that is).
There are stories from the ZFS folks of dealing with these issues and things ran just fine.
While not directly involved with ZFS development (IIRC), Bryan Cantrill was very 'ZFS-adjacent' since he used Solaris-based systems for a lot of his career, and he has several rants about firmware that you can find online.
A video that went viral many years ago, with Cantrill and Brendan Gregg, is "Shouting in the Datacenter":
* https://www.youtube.com/watch?v=tDacjrSCeq4
* https://www.youtube.com/watch?v=lMPozJFC8g0 (making of)
Let's say you have 6 drives in raidz2. If you have a 1% silent failure chance per block, then writing a set of 6 blocks has a 0.002% silent failure rate. And ZFS doesn't immediately verify writes, so it won't try again.
If that's applied to 4KB blocks, then we have a 0.002% failure rate per 16KB of data. It will take about 36 thousand sets of blocks to reach 50% odds of losing data, which is only half a gigabyte. If we look at the larger block ZFS uses internally then it's a handful of gigabytes.
And that's without even adding the feature where writing one block will corrupt other blocks.
- A RAIDz1 (RAID5) pool with a second disk start failing while rebuilding from an earlier disk failure (data was fine)
- A water to air CPU cooler leaking, CPU overheated and the water shorted and killed the HBA running a pool (data was fine)
- An SFF-8088 cable half plugged in for months, pool would sometimes hiccup, throw off errors, take a while to list files, but worked fine after plugging it in properly (data was fine after)
Then the usual disk failures which are a non-event with ZFS.
So shrug
mdadm doesn’t checksum data, and just trusts the HDD to either return correct data, or an error. But HDDs return incorrect data all the time, their specs even tell you how much incorrect data they’ll return, and for anything over about 8TB you’re basically guaranteed some silent corruption if you read every byte.
This is simply not true. I've been running bi-weekly ZFS scrubs on my file server which has grown from 80 TB to 200 TB of data over three years now with zero failed checksums. That is petabytes of reads with zero corruption. The oldest drives are nearing 5 years old (they were in a Btrfs Synology NAS before, again, zero failed checksums).
The wildly pessimistic numbers on the spec sheets are probably just there so they can deny warranty replacements by saying that some errors are in-spec.
People seem to love ZFS but I had no issues running mdadm. I'm now running a ZFS pool and so far it's been more work (and things to learn), requires a lot more RAM, and the benefits are... escaping me.
RAID is not backup, always remember that!
Like, which manufacturer goes, like "tests show we cannot write more that 400kB without corrupting drive, let us ship this!" ?
According to https://www.sqlite.org/howtocorrupt.html there are such drives:
4.2. Fake capacity USB sticks
There are many fraudulent USB sticks in circulation that report to have a high capacity (ex: 8GB) but are really only capable of storing a much smaller amount (ex: 1GB). Attempts to write on these devices will often result in unrelated files being overwritten. Any use of a fraudulent flash memory device can easily lead to database corruption, therefore. Internet searches such as "fake capacity usb" will turn up lots of disturbing information about this problem.
Bit flips amd overwriting wrong sectors from unrelated files being written are also mentioned. You might think this sort of thing is just cheap USB flash drives, bit I've been told about NVMe SSDs violating their guarantees and causing very strange corruption patterns too. Unfortunately when the cause is a bug in the storage's device own algorithms, the rare corruption event is not necessarily limited to a few bytes or just 1 sector here or there, nor to just the sectors being written.
I don't know how prevalent any of these things are really. The sqlite.org says "most" consumer HDDs lie about commiting data to the platter before reporting they've done so, but when I worked with ext3 barriers back in the mid 2000s, the HDDs I tested had timing consistent with flushing write cache correctly, and turning off barriers did in fact lead to observable filesystem corruption on power loss, which was prevented by turning on barriers. The barriers were so important they made the difference between embedded devices that could be reliably power cycled, vs those which didn't reliably recover on boot.
Those drives have a sudden flip from 0% corruption to 95-100% corruption when you hit their limits. I wouldn't count that as the same thing. And you can't reasonably expect anything to work on those.
> The sqlite.org says "most" consumer HDDs lie about commiting data to the platter before reporting they've done so, but when I worked with ext3 barriers back in the mid 2000s, the HDDs I tested had timing consistent with flushing write cache correctly
Losing a burst of writes every once in a while also manifests extremely differently from steady 1% loss and needs to be handled in a very different way. And if it's at power loss it might be as simple as rolling back the last checkpoint during mount if verification fails.
However, if something like a power failure or firmware crash happens, and the bookkeeping writes never happen, then the end result that the user sees after a reboot is their data written to the wrong sector.
> 1% chance of disconnecting and reconnecting a few seconds later
I actually have such an SSD. It's unusable, when it is in that state. The FS doesn't corrupt the data, but it's hard for the OS to make forward progress, and obviously a lot of writes fail at the application level. (It's a shitty USB implementation on the disk: it disconnects if it's on a USB-3 capable port, and too much transfer occurs. It's USB-2, though; connecting it to a USB-2-only port makes it work just fine.)
At least in Unix the assumption is that disks are always attached (and reliable...) so write errors don't typically bubble up to the application layer. This is why losing an NFS mount typically just hangs the system until it recovers.
I want to say a physical disk being yanked from the system (essentially what was happening, as far as the OS could tell) does cause I/O errors in Linux? I could be wrong though, this isn't exactly something I try to exercise.
As for it being a distributed system … I suppose? But that's what an FS's log is for: when the drive reconnects, there will either be a pending WAL entry, or not. If there is, the write can be persisted, otherwise, it is lost. But consistency should still happen.
Now, an app might not be ready for that, but that's an app bug.
But it can always happen that the power goes out, which in my situation is equivalent to a disk yank. There's also small children, the SO tripping over a cable, etc.
But these are different failure modes from some of what the above post listed, such as disks undoing acknowledged writes, or lying about having persisted the write. (Some of the examples are byzantine, some are not.)
But yeah, I agree that is what the journal is for. However, I don't know if the journal in "modern" filesystems works the same when a drive reconnects than when the power is cut out (the OS still being alive and all in the first case).
You could also look at this: https://rwmj.wordpress.com/2020/03/21/new-nbdkit-remote-tmpf... We use it for Koji builds, where we actually don't care about keeping the build tree around (we persist only the built objects and artifacts elsewhere). This plugin is pretty fast for this use case because it ignores FUA requests from the filesystem. Obviously don't use it where you care about your data.
Uhh hello, pricing ?
> maybe disable flushes with https://github.com/stewartsmith/libeatmydata
overlayfs has a volatile mount option that has that effect. So stacking a volatile overlayfs with the upper and lower on the same ext4 could provide that behavior even for applications that can't be intercepted with LD_PRELOAD
[1]: https://www.kernel.org/doc/Documentation/blockdev/ramdisk.tx...
[2]: https://blog.delouw.ch/2020/01/29/using-lvm-cache-for-storag...
Because I have the best storage performance you'll ever find anywhere, 100% money-back guaranteed: write to /dev/null. It comes with the downside of 0% reliability.
You can write to a disk without a file-system, sequentially, until space ends. Quite fast actually, and reliable, until you reach the end, then reliability drops dramatically.
On a related note, though, I've considered the idea of creating a "minimally POSIX-compliant" filesystem that randomly reorders and delays I/O operations whenever standards permit it to do so, along with any other odd behavior I can find that remains within the letter of published standards (unusual path limitations, support for exactly two hard links per file, sparse files that require holes to be aligned on 4,099-byte boundaries in spite of the filesystem's reported 509-byte block size, etc., all properly reported by applicable APIs).
P.S. I'm fairly certain that /dev/null would lose my data a bit more often than once a week.
Any files that are important would go to a separate, more reliable filesystem (or uploaded elsewhere).
If the stripe dies, worst case is I lose up to one hour of work, plus let's say another hour copying assets back to a rebuilt stripe.
There are so many MASSIVE files created in intermediate stages of audiovisual [post] production.
This is not the kind of frequency you need to protect against. You just need to detect it and replace the drive ASAP.
Bonus points for making the result efficiently support multiple nodes, each with multiple disks.