Would it improve the write performance to fill a reformatted drive with zeros?
I have a 2 TB drive which was filled to >99%. I’ve delete the partitions with fidsk
and formatted them with mkfs.ext4
.
So as far as I know, the actual data which was on the drive does still exist. Still the partition table was reassigned.
The question is: Would it improve the write performance for further write actions if the disk would be cleaned? With cleaned I mean fill the disk with zeros?
Something like
dd if=/dev/zero of=/dev/sdx bs=1 count=4503599627370496
No, it would not improve performance.
TL;DR: rotational magnetic hard disk drives don't work like that.
First, when you write any given data to a rotational magnetic-storage drive, that data gets transformed into magnetic domains that may actually look very different from the bit pattern you are writing. This is done in part because it's much easier to maintain synchronization when the pattern read back from the platter has a certain amount of variability, and for example a long string of "zero" or "one" values would make it very hard to maintain synchronization. (Have you read 26,393 bits, or 26,394 bits? How do you recognize the boundary between bits?) The techniques for doing this transformation between computer data bits and storable chunks have evolved over time; for example, look up Modified Frequency Modulation, MMFM, Group Code Recording and the more general technology of run-length limited encodings.
The actual recording process, such as HAMR, PMR, shingled and so on are orthgonal to this in that they describe the mechanics of how the magnetic domains are stored on the physical media.
Second, when you write new data to a sector, the magnetic domains of the relevant portions of the platter are simply set to the desired value. This is done regardless of what the previous magnetic domain was at that particular physical location. The platter is already spinning under the write head; first reading the current value, then writing the new value if and only if it's different, would cause each write to require two revolutions (or an extra head for each platter), causing write latency to double or greatly increasing the complexity of the drive, in turn increasing cost. Since the limiting factor in hard disk sequential I/O performance is how quickly each bit passes under the read/write head, this wouldn't even offer any benefit to the user. (As an aside, the limiting factor in random I/O performance is how fast the read/write head can be positioned at the desired cylinder and then the desired sector arrives under the head. The major reason why SSDs can be so fast in random I/O workloads is that they completely eliminate both of these factors.)
As pointed out by JakeGould, one reason why you might want to overwrite the drive with some fixed pattern (such as all zeroes) would be to ensure that no remnants of previously stored data can be recovered, either deliberately or accidentally. But doing so will not have any effect on the drive's performance going forward, for the reasons stated above. Another reason, which could conceivably be said to "improve performance", as pointed out by liori, is to help compression of unused portions of stored disk images, but even that doesn't improve the performance of the system in use.
You say this:
The question is: Would it improve the write performance for further write actions if the disk would be cleaned? With cleaned I mean fill the disk with zeros?
100% nope. Writing zeros to a disk does not improve performance. You would only do that to destroy data. So knowing that, you say this:
So as far as I know, the actual data which was on the drive does still exist.
Technically yes… The data that previously existed on the drive still exists on the drive on some fundamental level. That said, it does not exist in a form that is easy to access or recover at this point but it might be a concern if you are truly worried about the data being compromised by someone willing to make the effort to recover those fragments of data that remain.
So if security and privacy is a concern, then you might want to write zeros to the drive to make sure all free space is truly wiped. But security and privacy is the absolute only reason you would ever wipe out free space with zeros since doing something like that never improves performance.