How Controllers Maximize SSD Life (2012)
thessdguy.com
thessdguy.com
Some people would rather have full transparent overview and control over the state and health of their storage and make their own decisions about handling problems in software instead of talking to a black box.
The cost savings probably wouldn't be as dramatic as you hope. You'd still need some sort of controller for serdes -- NAND flash chips tend to use big parallel busses which aren't suited for off-board connectors -- and, at that point, it's not that much of a jump to make that controller handle wear leveling and error correction.
(Having the storage device handle those tasks is pretty convenient, anyways. It means you don't have to perform error correction on the main CPU -- which is a nontrivial ask -- and it means the SSD can behave as a bootable device.)
Error correction is well suited to hardware, whereas wear levelling in my opinion is not.
My ideal design would have basic hardware error detection and correction (hopefully configurable for how many data bits Vs ECC bits), and maybe with a few heirarchical levels. Wear levelling and management of data layouts would all be done in software.
You could imagine a "bulk read" API which is given a block number to start at, with a bunch of ECC parameters, which would DMA a large block of error-corrected data to RAM, together with information about the error rate in each word/block read.
There are a lot of existing SoCs that have built in flash controller hardware that can interface with an external flash chip and, from a driver perspective, are controlled pretty much the way you describe it.
The lack of a flash translation layer was a major advantage.
Amazon, Google, Microsoft and Apple are in a position to do this for their cloud offerings, but so far as I can tell they haven't. Which tells you it's probably not cost effective.
(I think there are benefits to be had from giving even local storage a "blob" interface, as you reduce the amount of random writes, but we're not there yet)
At least 2 of those named companies have their own mostly-software-controlled SSD designs.
The problem is that low-level or "raw" access to flash is not that well-defined and not "cheap" or "dumb" at all. SD cards and eMMC storage are cheap and use very baseline FTL's, but what they provide is far from "low-level" access - you can't even erase a block and write sub-blocks on it individually, which is the basic operation in any flash translation layer.
The "mtd" subsystem which stands for "memory technology devices" is a thin hardware abstraction layer for primarily raw flash devices with an internal framework for NAND flash with driver backends for all sorts of controlers and devices and support for e.g. software error correction if the device/controller doesn't support it, etc...
The "ubi" subsystem which provides wear-leveling, bad block management and LVM style logical volume partitioning on top of mtd. It does not emulate a normal block device, it acts more like a flash device with idealized properties.
The "ubifs" file system which was specifically designed for working on top of ubi.
If you try to use this stack on a large-ish scale to build a DIY Linux powered SSD, you might run into scaling problems with ubi tough (don't think some companies haven't tried that yet).
While it basically works, as always, pretty much every flash vendor guards the inner workings of their devices as secrets and those things have undocumented quirks and undocumented, secret instructions to work around various quirks used by the companies own SSDs and eMMCs.
> Could you make money by producing a cheap "dumb" flash memory where you have raw access and leave all the wear leveling to software by using one of the many available log structured file systems?
Technically, the market exists, but whether you could get into it and make money is another question. I'm willing to bet that if you design a NAND flash from scratch and try to sell it, the existing vendors will clobber you with patent infringement law suits.
AFAIK the reasons why Linux has ubi instead of a full, in-kernel flash translation layer are also legal ones.
You just have to be careful because the bootloader and NVRAM partitions are crucial to the device booting. Serious experimenters would find the serial port header pins and have a working serial port.
So you've got random writes both between zones and at the front of each zone. The one thing missing is being able to erase blocks within the committed portion of a zone, but idk how you'd support that without just reimplementing a block layer.
The idea of having some chip with software that I've never seen in charge of this seems crazy to me. You can look at how much data people lose on SD cards (every Raspberry Pi user will tell you they "go bad"); most of it is not loss of content on flash, but corruption from interrupting the internal MCU at a bad time. Remove that and use proper transactional writes, and they'd probably never instantly go bad. But, random write benchmarks would not look as good.
It was a lot of work; it had advantages but today it probably wouldnt be worth the effort.
I'm not going to assume that the complexity of what's going into these drives was not significantly reduced since, or did it?
https://www.researchgate.net/publication/274369001_Data_secu...
https://techreport.com/review/27909/the-ssd-endurance-experi...
Nowadays, 3-bit (TLC) and 4-bit (QLC) are much more common (not sure QLC even existed back then). So whilst each of these technologies has matured, the drive a consumer may consider today is more likely to be bigger, replacing their HDD entirely, and will probably be capable of fewer writes than an MLC drive from 5 years ago, iiuc.
This is especially important if you're not in North America because the brands that are available and affordable locally aren't always the same as what's good here in the US. (And on rare occasions, a product sold in multiple regions will have different internals depending on the region.)
For consumer SSDs, there's no need to worry about write endurance or QLC NAND unless you know you have a very atypical usage pattern and have actually measured your workload by eg. tracking SMART indicators on your current drive(s) for several days.
Brand matters very little unless you really care about the experience of getting a warranty replacement in the rare event that your drive fails before the warranty expires. I'm not aware of any solid information indicating that certain SSD brands have consistently lower premature failure rates. My anecdotal experience from reviewing SSDs for several years is that all the top-tier brands have at some point sent me review samples that were either DOA or died during testing that shouldn't have killed a drive.
Outside the top tier brands belonging to the NAND flash memory manufacturers, everyone is buying NAND on the open market from the same 2-3 manufacturers and buying SSD controller solutions from the same 2-5 vendors. There are literally dozens of retail models all using the same combination of Phison E12 controller and Toshiba/Kioxia 3D NAND, and the differences between these are almost entirely cosmetic. All the PCIe 4.0 consumer SSDs that have been released so far are functionally identical.
I'm curious what your SSD is and just how old it is, if it isn't giving you any SMART information. (Maybe you need to run `smartctl -s on` before it'll show you the stats it has probably been tracking all along?)
If you want to estimate your own personal write endurance requirements, then you want to keep track of the line that looks like:
Data Units Written: 67,509,873 [34.5 TB]
Figure out how much that goes up in a typical day/week/month, and you'll know roughly how much you endurance you need.When your SSD is old and you want to monitor it for signs of impending failure, keep an eye on the lines:
Available Spare: 100%
Available Spare Threshold: 10%
[...]
Media and Data Integrity Errors: 0
(Quoted stats taken from the 512GB PM981 I borrowed to test. It was barely used at the time.) Available Spare: 100%
Available Spare Threshold: 10%
Media and Data Integrity Errors: 10
Error Information Log Entries: 735
but I guess that's probably normal? A least unless it fails suddenly/catastrophically.