Hard Drive Effects of Continuous Delete and Rewrite

hard drivehardwareload balancing

What are the effects of continuously writing and deleting files on a magnetic hard disk? Specifically, do these files continue to be written on the recently cleared space or is there some sort of balancing mechanism to even out the wear on the drive?

Details on my situation: I have a batch of performance testing machines that constantly write and delete data to and from their individual magnetic hard drives. I keep replacements available and I'm not worried about data loss, just availability and comparable performance between drives (I can't switch to SSD, for instance). Is there anything I can do to extend the life of these drives or is uneven wear a necessary consequence of constant r/w testing?

Best Answer

Magnetic hard drives don't experience wear the same way SSDs do. My understanding of the physics at work say that each block can undergo on/off state changes for very long times. For workloads like you describe magnetic media should last quite some time, so long as you get enterprise drives.

Another variable here is the filesystem used. When a file is deleted it could be only a few blocks get updated in the metadata of the filesystem and the blocks of the file are never touched. Others may actually zero those blocks which would be a long write, though such configs are rare. The access patterns you describe are likely just mostly write to the disk.

As for balancing, again that depends on the filesystem in use. The blocks containing the metadata will be hit a lot more often than the blocks containing files, so if wear were an issue those would be the blocks that would wear out first. Some filesystems will purposely not overwrite recently deleted files expressly so such files are easier to recover. Others don't care. Some filesystems, such as XFS, write to the Superblock constantly; so much so that on SSDs that don't have wear-levelling that block can die within weeks. And yet, on magnetic media those blocks are seldom the first to go.

Related Topic