How Power Failures Corrupt Flash SSD Data
An anonymous reader writes "Flash SSDs are non-volatile, right? So how could power failures screw with your data? Several ways, according to a ZDNet post that summarizes a paper (PDF) presented at last month's FAST 13 conference. Researchers from Ohio State and HP Labs researchers tested 15 SSDs using an automated power fault injection testbed and found that 13 lost data. 'Bit corruption hit 3 devices; 3 had shorn writes; 8 had serializability errors; one device lost 1/3 of its data; and 1 SSD bricked. The low-end hard drive had some unserializable writes, while the high-end drive had no power fault failures. The 2 SSDs that had no failures? Both were MLC 2012 model years with a mid-range ($1.17/GB) price.'"
Seriously... slap in some basic power circuitry and some caps - enough that the drive can finish the cycle it is on and do whatever it needs to do to power off safely.
For large sets, this will be our guide even unto death, for the LORD will work for each type of data it is applied to...
The paper doesn't disclose the brands.
Belief is the currency of delusion.
Always RAID and have battery backup, it saves lives.
Last time I checked, standard platter-based disks had the same issue -- a problem that is solved in server/enterprise environments by placing a write-cache battery in the RAID controller.
:)
In a desktop environment I suppose one could embed a write cache battery into the SSDs to abate the issue, but in a laptop environment it'd be unlikely you'd even encounter it since you'd have to be writing data while running out of battery, in which case, you might well deserve it
... Power failure corrupts absolutely.
Why should a power failure corrupt anything? The UPS will shut the computer off if there is a prolonged outage.
These devices have an elaborate internal database for the management of block remapping. For this to survive power failures it needs to use transactional updates. Getting this right is hard - it takes years for file systems and databases to become robust. I'd guess that many devices don't even attempt to do it and the ones that do probably have obscure failure modes. A UPS is essential.
I had some original Vertex drives from OCZ that kept absolutely corrupting when my laptop got accidentally unplugged and I powered on the machine. I had to RMA them over and over and over again. I finally figured out that my battery was getting old and, although everything was functional even on battery power and it would boot, the initial large draw of power on boot must have created a voltage drop (i.e. brownout) which the SSDs weren't designed to compensate for. Within an hour of boot (even back on plugged power) they would choke, freeze the OS, and be rendered unusable from then on out.
Several SSD manufacturers are probably not engineering well for fluctuating power. Rather than fixing the problem with better engineering, OCZ simply changed their warranty policy to void the warranty if the customer is not providing proper power which, correct me if I'm wrong, I don't think rotating disk hard drive manufacturers have had that in their warranty clauses.
We encountered extensive and progresssive file corruption on SSDs in an industrial device. It used the FAT file system, and after every loss of power, it ran its equivalent of chkdsk/f at the next boot. If power was lost again while this command was running, then it was guaranteed that the file system would become corrupt (despite the fact that we were writing nothing to the SSD; it held only files which were opened for reading). The window of opportunity was described as "very short", and the possibility of corruption was "very small" according to the vendor. In our experience in the field, and in our internal testing, the window of opportunity exceeded 20 seconds, and the possibility of corruption was "utter certainty".
The vendor fixed the problem in a very easy way. They changed the file system from FAT to a commercial journaling FS. In our subsequent tests, we never found any file corruption, even on iterated power loss at random intervals after power on.
Those who can make you believe absurdities can make you commit atrocities. - Voltaire
enterprise-class SSDs have capacitors designed to last long enough for the SSD to finish any writes if the power fails.
Capacitors cost money though.. so this is one of the things that gets stripped out of consumer-level drives to reduce the price.
There is all kinds of extra space in a 2.5" SSD. They have a lil' CPU, some flash chips, and that's it more or less. They are quite small. In smaller form factors, then ya space can become an issue but there's plenty in a 2.5" unit.
Useless paper/test.
Who logs in to gdm? Not I, said the duck.
What some of folks don't realize is its the seesaw nature of many power events that's primarily behind both data corruption and SSD failure. It's a rare rack system that has its own power conditioning and UPS these days (HP NonStop comes to mind) and without it you're subject to whatever the event provides in the way of under/over voltage, spikes, drops, etc. Many times these happen in timeframes too fast for power switching equipment to react and in some cases its that stuff that gets fried first.
Organization? You must be joking..
There is a protection mechanism that I know exists in Crucial SSDs which makes the drive appear dead after some unclean shutdowns of the drive while it performs a firmware-level integrity check of the drive. It may exist in other brands as well. Sometimes it takes 2 runs of 30-60 minutes to get the drive to re-enumerate via SATA. I'd be curious to know if the "dead" drive was affected by this bug.
"We use synchronized I/O (O SYNC), which means each write operation does not return until its data is flushed to the device."
Sure about that? Most of the devices I've seen will report "command complete" while data is either in DRAM or in flight even with write cache disabled. There's only a few that don't do that, and they aren't the cheap ones. You may get lucky on a major player stuffing some decent code in a consumer grade SSD for the sake of fewer firmware versions in manufacturing, but it's usually not the case.
Any device with a "super cap" over 2 years old is suspect. They degrade. All of them are using ceramic arrays now, and only guarantee data in flight if you're really pestering them on a design review.
Also the "brick" may not be a brick. When these drives have to rebuild translation tables, it can take a while. I've seen 60+ minutes on a 400G device. Leave the power on and wait a couple of hours. Reboot. You might get your drive back, maybe even most of your data. I wouldn't count on the last write, but you may get that too if their raid works.
Most enterprise SSDs do have small supercapacitors or capacitor arrays onboard for exactly this reason. Some of the higher-end consumer drives do too. But most consumer drives don't.
The answer? Get a UPS.
A UPS is no panacea: I experience grid failure very rarely.
However, relatively speaking I experience many more kernel lockups that require an ACPI-initiated poweroff by holding down the power button until the machine abruptly powers off. What do you do when a reboot/poweroff command causes your Linux/BSD machine to hang? I/O handle leaks in the Samba SMB client (ie. *not* the smbd daemon) and the Samba Winbind code are notorious for this. The only times I have ever had to "yank power" from a production Linux database machine were due to SMB share mount zombies or Winbind that the kernel couldn't kill even during an issued reboot command.
I have several OCZ Vertex 4 SSDs, and this concerns me—especially due to the fact that the paper/presentation does not disclose the test results. I guess I will just have to hope that my device models aren't affected and/or that waiting a minute or two during a hung poweroff/reboot means the kernel has stopped attempting to write to the devices and everything has flushed.
PS. If you compare the vague results in the summary with the paper you will find that only two of the fifteen drives passed the tests, yet four of the devices were cited to have power protection capacitors.
This reenforces my personal policy - if it is not a self-powered laptop (usually running on mains), all of my other computers are powered through UPS (Uninterruptable Power Supplies), e.g. Belkin, APS, et. al. I learned this the hard way when a brief power interruption scrambled several conventional hard drives on an old Mac Quicksilver.
This is old news; see fx Wikipedia's coverage. Only buy SSDs with a battery or capacitor, or whatever is the in DRAM cache of the SSD will be lost on power failure.
Uhhh...we solved this problem ages ago with UPS. If you care about your data put the machine on a UPS. I've had my business customers on UPS systems for years, showed them how to test the batteries and swap 'em when they get worn out, no problems.
That may help, but it isn't sufficient. I had one client on an APC SmartUPS that caused more power failures than it prevented. Why? Ambient thermal shutdown of the SmartUPS resulted in it abruptly powering off repeatedly even while the grid was up. So, if they did not have a UPS installed they would not have had any of those power outages, and, for bonus irony, grid failures were quite rare and never occurred while I was there.
This may seem like it goes without saying, but the installation context matters.
This is why I don't use prototype tech that is really not ready to be used in the real world. And if you do, expect loads of bugs and bricking.
But either way, thanks for funding the development of something I am excited to try out in 2-4+ years when it will be a mature usable technology.
Troll is not a replacement for I disagree.
I think you make a good point about warranty clauses, and it would be hard to imagine HD manufacturers singling out their SSDs with an inferior warranty in this respect.
Considering the paper cited by TFA won't spill the beans on which models were tested, it may be a safer bet to purchase SSDs from traditional HD makers (at least I hope that is the case with my Samsung).
So for servers we should use a mixed SSD/hard drive RAID for data integrity?
Need a Kilowatt? Buy 2. Yes it sucks but you have to play the game and that I've found is a good hard fast rule that works for pretty much any company in the UPS business.
Yes, that sucks, and I am no defender of the UPS industry.
However, remember that UPS's are listed VA rather than watts. Power factor is an important issue, and that's why a UPS/small gasoline generator sucks for spinning up an A/C unit motor, or in the case of technology, a highly capacitive load. If (and only if) your load is purely resistive then VA==watts, otherwise, watts < VA consumption. All computer systems will have a power factor of <1. Simply put, if you drive an incandescent light bulb then VA is the same as wattage, but if there is any capacitance (computer hardware) or inductance (motors), then VA is higher than wattage because the power factor is less than 1.
VA is the only fair metric for a UPS manufacturer to use, because it's trivial to come up with a load that has very high VA consumption while having close to zero wattage (ie. very low power factor)... however, that high VA load still drains the UPS battery that is running an inverter to produce an AC waveform.
Watts pulled from the wall (ie. with no power factor applied) is most certainly not the same as the VA that UPS capacity is listed in. It makes sense that it is harder to spin up a motor or drive the capacitive load on a computer than it is to drive a simple resistor like an incandescent light bulb.
Now, if you're alleging that the manufacturer-cited UPS VA capacity is being treated similarly to the laptop manufacturers' "estimated runtime" inflation then you may be right. I just wanted to ensure you were comparing apples to apples.
Not occur anywhere on this page?
Need Mercedes parts ?
Yes, lets just not use anything that fails once and a while, even if it is even less than the thing it is protecting.
Back when I was still using desktops I had more power outages from a consumer UPS going bad (say, twice a year or a bit more) than I did from real power failures.
Furthermore, you could tell a normal grid power failure was probable in some cases, say a severe lightning storm. Then you could prepare a bit, at least making sure things were saved. A UPS failure strikes at any moment at all without care.
AND a power failure from the power company is likely to be short. A UPS failure is GUARANTEED to last until you physically unplug the UPS from the path to power, so say if you are not at home that system is offline until you get back.
"There is more worth loving than we have strength to love." - Brian Jay Stanley
Power loss protection (super capacitors) was stated on four of the drives (the four least expensive to boot). Only three performed flawlessly in the unserialized writes test. Those aren't great odds. In fact only two drives passed all tests with no errors, and it wasn't necessarily the SLC "enterprise" drives, though those two also passed the serialized writes test.
In case you aren't aware, unserialized writes invalidate *every* assumption, including write ahead, journaling, even your fancy BTRFS/ZFS. His example is a database where the transaction log write was sync'd before the data page write, then after a power failure the data page is persisted but the log write is gone.
You can recover from many of the other errors or at least detect them but unserialized writes can silently corrupt data or even ruin the entire filesystem.
Obviously the metadata/dead failures are the exception... Those render the whole SSD useless.
Natural != (nontoxic || beneficial)
I'd suggest, then, that you've been buying the wrong UPSes, because while they do occasionally fail, they don't fail at anywhere near the rate that you've experienced (or rather the quality brands don't). I've owned several units for quite a few years, and none have ever failed while powering equipment in a manner that caused a power loss. An expired battery did cause a failed self-test, but that didn't cause any outage, merely the indication that the battery should be replaced. Another unit (the one time I bought a noname brand) did fail catastrophically, but not while actively powering equipment.
After buying several different brands I gave up. Most were around $100, it's not like I was buying the cheapest UPS systems I could (at least not after the first one failed).
I will say that I bought a UPS a year ago for just my router, and so far that has not failed. So I think it was really more a matter of UPS systems really not being able to handle anywhere close to rated load, as some people have discussed in other comments... Again that was with a desktop system and a monitor, it should have been within tolerance but obviously it wasn't as the UPS systems kept dying.
"There is more worth loving than we have strength to love." - Brian Jay Stanley
The problem was any $100 UPS isn't a good UPS. Most decent UPS's are going to be closer to $300, which is pretty expensive for many users (though not business users who could easily lose $300 worth of work in the blink of the lights). More expensive battery backups monitor your batteries and perform tests on them and give you very good performance metrics. Closer to the $500 range an you'll get in to the 'online' UPS range that conditions all power to the device. Oh, and make sure the electrical system you are plugging in to has a proper, low resistance ground.
What to take from this.
1. A $100 UPS is not a good UPS, doesn't matter who makes it.
2. Like any component, look at the cost of downtime and restoration caused by UPS failure and price the unit you get accordingly.
Reading the original PDF, I noted the following: "Our testing framework detects unserializable writes with HDD#1, too. This indicates that some low-end hard drives may also ignore the flush requests sent from the kernel. On the other hand, HDD#2 incurred no failures due to power faults. This suggests that this high-end hard drive is more reliable in terms of power fault protection." Now, for ref, the above involved testing TWO spin-type HDD's .. HDD#2 was the 2nd drive of the pair, and it reportedly did not fail.
While I was doing bio research I recall this joke:
"33% of the test subjects improved with the treatment, 33% had no improvement, and the 3rd mouse got away"
WHY oh why even *mention* such a meaningless 'result' in a paper that otherwise seems to adhere to proper scientific methods??
Oh , and yes, of course, how come it's ONLY the researchers who learned which drive brands did well??
Was this gov-funded? This is important, for if we were to learn that the SSD's that did well are no longer available on the market, it would save us a LOT of time, not even considering that any of the 'surviving' SSD's might be known to have other serious flaws in design .. (i.e.: in performance ) !!
"There are 11 kinds of people: those who know binary, those who don't, and those who could not care less!"
I've been using UPS for years, and I've not had one fail in such a way once. The closest to failure that I have is that one only lasts for half a minute or so (the lead plates in the battery are trashed).
In return, since the ones I buy have voltage regulators, I've never had to replace a dead power supply since I've been using them. Not. Once.
For large sets, this will be our guide even unto death, for the LORD will work for each type of data it is applied to...
I'm envisioning a little PCB that goes between a power cable and a SSD, and has some power management parts and a holdover capacitor. If power fails it would provide power to the SSD for a few seconds, hopefully long enough for it to flush its data to NAND. Could also do overvoltage protection etc. to prevent a bad power supply from frying the SSD as an extra feature. Should only cost ~$10-20 or so to make in quantities of 10 or so, and be a pretty quick design to bang out.
It won't fit in anything other than a desktop PC. And I wouldn't be surprised if some SSDs would still drop dead with the card, because they'd have some dumb quirk like the controller hanging up if the SATA interface drops dead...
My ex-boss had to deal with this problem. Short version: power issues are potentially worse to SSD than to hard disks.
I got an SSD one and half year ago, for my home desktop rig, and "teased" my then-boss into getting one for his work laptop.
My SSD is up and running nicelly (with stable current, very rare power outs), always shutdown, no hibernates or something like that.
My ex-boss had to RMA 3 or 4 diferent SSDs, because he uses hibernate on his laptop and a couple of times after resuming, the SSD simply "reverted" to a previous "disc state". For example, after installing Windows 7, and the software and data, the SSD would "reset" back to the point right after installing Windows. Also, one of the times he completely formatted the SSD and after a reboot, it went back to the time it had Windows and everything else! Really odd and freakish, and usually an hibernate or even a normal shutdown was done before the SSD broke / bricked / froze...
The laptop was not very recent (was probably 2 or 3 years old by the time he got the SSD), so some SATA driver issue combined with different power requirements or improvement over those years might explain such an unlucky streak...
My SSD is still running nice and good, my ex-boss meanwhile replaced his laptop and SSD.
"A sysadmin is a cross between a detective, a police officer, a gardener, a doctor and a fireman"