Many tutorials suggest zero-filling a drive to fully erase it for further use, but I have never seen anyone suggest one-filling a drive for any reason. Is this an arbitrary convention, or is there a reason why zero-filling is better than one-filling?

Is one harder on the device physically than the other? Other than security (for which I understand a random fill is better), are there any other possible considerations?

  • Some discussion over here....security.stackexchange.com/questions/10464/… – Moab Feb 8 '19 at 4:32
  • Thanks, I did find that but it is a slightly different question and is focused on data security. Regarding that question, I would ask whether multiple writes of all ones are functionally identical to multiple writes of all zeros. – Stonecraft Feb 8 '19 at 4:41
  • 1
    Yeah but there was some useful information on how a magnetic drive stores a 1 or a 0 – Moab Feb 8 '19 at 13:57

Is one harder on the device physically than the other?

Nowadays many drives internally encrypt data, so all zeros (or all ones) are stored internally as "mixed" values anyway. Therefore it shouldn't matter. In case of flash memory (like SSD) use TRIM to "fully erase it for further use" (zero-filling or one-filling is not equivalent to TRIM).

are there any other possible considerations?

I'm a Linux user. From my point of view zeros are extremely easy to get because there is /dev/zero in the OS. Getting all ones is not that easy. It's the only reason to prefer zeros I can think of. And since the easiest way to fill a drive with anything is to use dd, cat or cp (rather than writing your own program), filling with zeros from /dev/zero seems natural.

Zero-filling is easy:

cp /dev/zero /dev/sdX

while one-filling requires some additional work:

</dev/zero tr '\0' '\377' >/dev/sdX

Note the latter can be used to fill the device with any fixed byte value. In this sense all ones are as "hard" to get as any other byte except all zeros.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.