37

I used to have bad sectors on my SSD about one month ago. I had fixed them through performing one level of zero formatting. However, after few days, when I was rechecking, I have found bad sectors again. Now, I am considering to wipe my drive again. Hence, taking backup, making drive free and losing data will be inevitable.

My question is, How can I prevent getting bad sectors again? And what is the best way in order to repair them?

Thanks in advance

14
  • 2
    There are two kinds of bad sectors; physically bad sectors, and logically bad sectors. Logically bad sectors can be repaired via LLF or tools like spinrite, but physically bad sectors cannot be repaired at all. Most of what I know about this is related to mechanical disks, so I don't want to lead you astray on SSDs, but generally speaking, bad sector count either remains stable, or grows quicker and quicker over time as the drive fails. watch the count. you may have the same number you previously had, and if it remains stable, you may be fine. May 26, 2019 at 8:27
  • 2
    Also, what tools are you using to check for bad sectors? I've been assuming that you are reading SMART data, which is written on a rom on the disk controller. SMART stats will not reset on a format, so far as I'm aware, so if it had noted reallocated or current pending sectors, they are still the same bad blocks you had from before the format. They are permanent. watch their count. if it rises, buy a new disk. I use Speedfan in windows, or gnome Disks in linux to check disk SMART stats. May 26, 2019 at 8:32
  • 17
    Don't "wipe" an SSD with zeroes like a rotational hard drive. This just wears the flash out faster, and does not actually zero all sectors of the flash. Use a secure erase utility or the vendor's utility to erase an SSD. May 27, 2019 at 3:02
  • 4
    @MichaelHampton Or just delete the encryption key. That is how modern large capacity drives do fast delete.
    – Aron
    May 27, 2019 at 7:30
  • 9
    Bad sectors appearing on an SSD are an indicator of imminent failure. Especially in conjunction with slowdowns. You will have to replace the drive - it may fail suddenly and completely.
    – pjc50
    May 27, 2019 at 8:18

5 Answers 5

90

You can't prevent bad sectors.
If you reformat all you are doing is remapping around them, so they're no longer available for use.
They cannot be repaired & if they start to appear at an increasing rate, it's a good sign your drive is on its last legs, about to fail.
Backup & replace before that happens.. not after.

2
  • 25
    You should have a backup, regardless of the state of your drive. (And a strategy to recover from backups and to test the backups.) May 26, 2019 at 22:42
  • 7
    If OP is reformatting either they already have a backup, or one is not required.
    – Phil
    May 26, 2019 at 23:20
39

First, as always, I'll start by saying storage is unpredictable and you should always have a backup.

Now, "bad sectors" behave quite differently on HDDs and SSDs, and have different common causes (and a very long tail end of uncommon but possible causes, hence the unpredictability). But in both cases, the suggested procedure is to replace the drive ASAP and either restore from backup or go for data recovery.

You can get quantitative data on drive status and impending failure by gathering S.M.A.R.T. data from the drive, using a tool like smartmontools/smartctl on Linux or CrystalDiskInfo (or gsmartctl) on Windows.


Most commonly, a series of bad sectors on a HDD suggests physical damage to the platter. This is often apparent in S.M.A.R.T. data as the "reallocated sectors count" goes up (the drive starts using its spare sectors) and "pending sector count" is above 0 (there are no spare good sectors left [!!!]). These tend to "spread"/"grow", i.e. the physical damage gets worse the more the drive tries to read it.

This is why the usual advice for bad sectors on a HDD is to replace ASAP, and sometimes this gets to the point of "stop using the drive; the only thing you should do on it is run a recovery tool like ddrescue because at this point remaining drive lifetime can be just a few hours or less, in the worst case.


A SSD is a different story. Each cell has limited "write endurance", and each write damages it slightly (very, very slightly). These are often rated in "TBW" (total bytes written) and "DWPD" (full drive writes per day, for its warrantied period usually 3-5 years). A high-quality drive can even be expected to exceed its rated writes without obvious adverse effects. This is often represented in S.M.A.R.T. data as a "media wearout indicator" or similar, and like a HDD, a SSD usually has extra cells it can use to replace a cell that has worn out.

If you're seeing "bad sectors" on a SSD, and the number seems to be increasing, it's likely that you've hit the point where the wearout is above the spare cells the SSD had (more likely on older or cheaper SSDs). With modern SSDs with wear-leveling, this means all cells are likely in a similar state, and, much like bad sectors on a HDD, this problem will only grow. And, much like a HDD, it is time to replace the drive.

Depending on the SSD size and age, it may also be worthwhile investigating what may be causing a large number of writes on your system: it's rare for a SSD in consumer use to actually wear out these days.


tl;dr: Check S.M.A.R.T. data. Replace the drive. There is no recovery.

1
  • "it's rare for a SSD in consumer use to actually wear out these days" That is not true I see it frequently in consumer laptops that came with 4GB of ram from the factory and end users have installed SSD disks in them. And the older generation of SSD without good wear leveling are really bad about this. The M.2 disks should hopefully be a bit better. May 27, 2019 at 21:25
5

There are different kinds of bad sectors, and different causes. What you describe is of the "bad" kind.

While disks are expected to work mostly reliably, reality has it that bad sectors happen, especilly in adverse conditions, and towards the end of a device's lifetime. Drives will luckily, and unluckily, automatically remap bad sectors when they occur, you usually do not ever even notice unless you look at SMART info.

However, you did notice, which is bad. Because when a sector (or rather block, SSDs arrange sectors in larger blocks, and can physically only erase complete blocks) gets "bad", that normally means it cannot be erased and written to any more, but the data is still recoverable. The drive will covertly copy everything to a more healthy sector and will never tell you. SSDs do that all the time during normal operation anyway, this is called "wear levelling". So there is really no externally observable difference. But you did see a difference, and that's bad.
Either, this means the drive has already had so many failures that it has already run out of reserve sectors, or it cannot even read the sector any more, or the controller has a serious problem, or the whole thing is about to die. Or, whatever. In any case, no good.

Unrecoverable sectors are something that are generally considered to be "normal", although with a very, very low likelihood of occurring. Manufacturers say something like 1014 or 1015, but 1012 may be more realistic. Still...

Your mileage may vary, but I replace a disk when the first unrecoverable reads happen because on a healthy drive that kind of stuff just doesn't happen. Yeah, it's a "normal" thing, and it can (in theory) happen, but it doesn't happen. You can't trust a drive that has non-zero failures with your data.

You can somewhat mitigate that bad things will happen by having quality hardware and treating your hardware with respect. For the most part, that means no high temperatures, no electric "surprises" or other "harsh physical stuff". SSDs are much less sensible to "harsh physical stuff" than spinning disks, but they are not indestructible.

Fixing bad sectors (on any kind of disk) is an extremely stupid idea, only topped by overwriting a SSD with zeroes, which is even worse. Do not do that, ever.

What "fixing" bad sectors does is nothing but marking them as unreadable. The drive will remap the sector and thereafter never let you access that sector any more. That's as bad as it gets because often data can still be recovered when applying some patience. There are programs (like ddrescue) which copy partitions and re-read unreadable sectors a couple of hundred times in the hope that eventually a read succeeds. This takes forever but surprisingly it actually works! I've had to do it once a few years ago. However, after "fixing" bad sectors, you are out of luck. Your data is gone forever.
Zeroing a SSD will do two things. It will kill your data, and it will add one unnecessary complete erase-write cycle to every block. That's not what you want.

What you probably want to do is back up all data ASAP (if you haven't done that previously, which you should have done), then replace the drive.

Also, for the future you want to run an automated daily backup job. Yeah sure, only wusses do backups. But seriously, run an automated backup every evening, no exceptions. No, not once a week, every evening. If you have a weekly backup job because it's so annoying that it takes so long in the evening, you will have to rescue data (talking out of experience). Because when you back up weekly, it is guaranteed to happen that you get a failure 6 days after the last backup.

Before trashing the drive, be aware that your drive may not be guilty after all. I've had it happen some 7-8 years ago. The "expert" at the shop where I had my PC built talked me into buying a MSI board which was exactly as good as the ASUS board that I wanted (only, he probably had a better profit marge on that one).
So... stupid... fell for it, only to discover a week later that I got some corrupted files. Replaced disks, same problem. Eventually got a few bluescreens, ran memtest. Every now and then, once per hour or so, it would show a randomly occurring memory error. Had all RAM replaced, no avail. End of story: The mainboard wasn't compatible with the RAM.
Bottom line: It probably is the disk's fault, but not necessarily so.

1
  • The 10^-14 to 10^-15 URE rate is (in every case I've seen) quoted in terms of full sector errors per bits read. A value of 10^-12 would mean that for every 10^12 bits read, statistically you'd expect to see a full sector (4 KiB) read failure. That's 4 KiB in about 10^2 GiB (100 GiB) read. If that were the case, you could expect a single read pass over the contents of a reasonably-sized drive to come back with a few bad sectors. I doubt even the cheapskate SSDs are that bad.
    – user
    May 28, 2019 at 13:57
4

There are 2 ways to REDUCE the formation of bad sectors in a computer:

1) Increase the amount of physical ram. With a modern operating system when it runs out of physical memory it will page out ram to the disk. This paging process is very disk intensive and it will destroy your SSD quickly.

Under Windows 10 run the program "Resource Monitor" and check the Memory tab. If you don't have at least 50% ram allocated to "free & standby" then you probably don't have enough. As a rule of thumb windows 10 desktop systems need around 16GB of ram to minimize paging. With magnetic media you can get away with 8GB of ram because the magnetic media isn't "worn out" by paging. I think it's absolutely disgusting that computer sellers still sell devices with 4GB of ram in them but this industry has a lot of scammers in it.

Some people with SSDs delete their paging file by going into Control Panel, System, Advanced System Settings, Settings, Advanced and changing it but I do not recommend this as if the system artificially runs out of swap space things will crash. And some Linux distros will crash without swap. Linux and I believe windows move seldom-used ram to swap to free up main ram for caching which speeds up the system

I WOULD NOT run a swapless desktop or laptop with anything less than 32GB of ram.

2) Add a small magnetic media disk (assuming you have a desktop) and move the swap to there.

Your problem is very common with people who DO NOT UNDERSTAND computer performance. A common trick these days is to shove a too small SSD disk in a laptop with inadequate ram and then the salesman can demo the laptop booting up super fast and that gives the tech-wanna-be wet dreams in the store so they run out the door with the thing under their arm.

There is NO substitute for increasing main core ram to speed up a computer. Yes it is much more expensive than an el-cheapo 256GB SSD but true speed costs money whether it's a car or a computer. A $5 fa rt can doesn't make a car go any faster anymore than a cheap SSD with inadequate core ram makes a computer go any faster.

1
  • 1
    Welcome to Super User Ted. Thank you for your answer, but can you edit it and add some citations for the claims you are making? Cheers
    – bertieb
    May 28, 2019 at 0:20
0

SSD's are rated in wear cycles. This means that the more writes to the SSD the further along you are in using up the total number of wear cycles on the SSD

When main ram is overcommitted, the machine pages out to the swap file. This creates additional writes than would otherwise happen if the main ram was not overcommitted.

Therefore one way to REDUCE writing to an SSD on a "regular PC" WITHOUT just turning it off or reducing use of it, is to reduce paging on it - reduce use of the swapfile.

Increasing main ram decreases use of the swapfile because there are fewer writes to the swapfile.

Unused main ram is allocated to the disk cache so even if the machine is NEVER overcomitted on ram (highly unusual for an average desktop) increasing the disk cache will also reduce writes to the SSD

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .