53

I had a PC with two OSs installed, which hard drive I erased using Disks from UbuntuUSB. I chose quick erase. As I understand, it deleted partition table, but all files' ones and zeroes are still on the HDD. I then created new partition table, and installed Win10.

Question: would the HDD work (read/write) faster now, if I overwrote it with zeroes?
Or: is writing information onto zero-overwritten HDD faster than on a "dirty" HDD?

Hashim Aziz
  • 13,835

7 Answers7

96

Hard drives do not store the literal zeroes and ones that I suspect that you think they do. Instead, they store the data in an encoded format that guarantees that there won't be too many zero bits or one bits next to each other. A long run of zeroes or ones could actually cause synchronization issues when trying to read the data because of minuscule variations in platter speed, vibrations, etc of the physical medium on which the data is encoded to, so it's limited to a certain tolerance.

In addition, hard drives always encode an entire sector (typically 512 bytes or 4096 bytes of data) at once, not just the bits that have changed (again, because it's encoded data). This ensures that the entire sector is correctly encoded every time. So, filling the drive with all zeroes has no practical benefit, although it doesn't harm anything either, other than the minor mechanical wear caused by doing so. You can choose to overwrite everything with zeroes if you want to, but it will have no performance benefit, and you'll simply waste your time waiting for all those zeroes to be written.

Solid state drives go through a similar process; they automatically erase the previous contents of a block before writing a new block of data, so writing all zeroes to a SSD would cause unnecessary wear on the device, as flash technology can only be erased a variable, but finite, number of times before failure. The wear introduced would only be something like 0.01% of the total duty cycles, but it's something that you would want to avoid doing on a regular basis.

phyrfox
  • 1
  • 21
  • 17
55

No, it will not be faster. Writing takes the same amount of time regardless of the data being overwritten.

11

This depends on:

  • Whether it's a mechanical HDD or an SSD.

For an SSD, as other answers note, you should not overwrite with zeroes (which would impose unnecessary wear on the Flash cells), but instead use either a Secure Erase or a full-disk TRIM. Some of the more recent versions of formatting utilities will do a TRIM automatically if they detect an SSD. The reason for this is that SSDs make a strong distinction between an "empty" sector and one "filled" with any data, including zeroes.

  • Whether there are unreadable sectors on the drive.

Many drives will develop a small number of "bad spots" if used hard for several years. Any that have already been encountered will show up in SMART data as "Pending Uncorrectable".

If there are no unreadable sectors, a mechanical HDD does not benefit from being overwritten, though it also does no harm aside from consuming a lot of time up-front.

If there are some unreadable sectors, attempts to read them will take a long time, and the drive will keep trying to recover the data in spare moments, which will affect performance. Overwriting them will prompt the HDD to discard the existing data, test whether the physical location can still be used for storage, and allocate a spare sector otherwise. This will also reset the "Pending Uncorrectable" counter.

TL;DR - Generally, don't do it.

Chromatix
  • 368
5

No, overwriting with zeros will make no difference in speed for a hard drive. However, for a solid state drive, overwriting with zeros is worse than doing a trim operation, which marks the blocks as unused. TRIMing the partition or the whole drive for an SSD before installing the OS may result in performance and lifetime benefits for the SSD. If you've already installed the OS, there are techniques to trim the free space in the filesystem for a similar benefit.

alex.forencich
  • 649
  • 4
  • 7
2

When you are doing a "slow format", usually is performed also surface test for bad blocks on the drive, so it may be reasonable for older HDDs but you shouldn't notice any R/W performance difference.

0

There is no difference either for HDDs or for SDDs.

In the case of HDDs, the date on the drive is magnetically altered on each sector you write to so it's irrelevant what you write there.

Further, writing random data is better than writing zero's because it messes more with magnetic alignment traces and for advanced forensics it will be quite more difficult to determine what was there before in the case of random data overwrite vs. zero's overwrite.

In the case of SSDs, if you command a value to go to zero or one it makes no difference, it still takes the same time to write the memory blocks, but due to the TRIM optimizations you may find that you cannot overwrite the specific areas you desire. Instead, just make a self-expanding file that takes all the free space and that way it is guaranteed that everything will be written to, preventing any recovery.

Overmind
  • 10,308
0

No, there will not have any speed difference, but you have unnecessary weardown, and an unnecessary chance of failure.

Traditional harddisks encode data with a simple pseudorandom generator, more modern ones and (virtually) all SSDs encode data with AES, always. The reason for that is that storing random data (or random-looking data) is much more favorable towards wear-levelling, both on magnetic and solid state drives, but in particular in the case of the latter (thus AES is first and foremost used to scramble bits, but as a free bonus, you can have security at no extra cost).

Thus, writing out a lot of zeroes effectively writes out a lot of "kinda random bits".

That's that, and it isn't in any way faster to read (or overwrite) one or the other either.

On the other hand, overwriting the complete drive means writing some billion sectors. While harddrives have (purely fictional) failure rates that are so low that they seem like "never happens", given the huge sizes of modern disks "never happens" is much more like "is kinda likely to happen". It is for that reason that for example RAID-5 is no longer recommended because the likelihood for encountering an unrecoverable failure while trying to re-sync after a failed disk is so high that it might become a practical concern.

What does that mean? Well, it means nothing in general, but overwriting the complete disk without need is probably not a good idea. Even for a secure erase, if that's intended, there exist nowadays much better (faster and more reliable) methods.

Damon
  • 4,622