Is `zpool initialize` destructive?

The documentation suggests it’s not?

Begins initializing by writing to all unallocated regions on the specified devices, or all eligible devices in the pool if no individual devices are specified. Only leaf data or log devices may be initialized.

I’ve also read the associated commit and it seems harmless. Just making sure before I run it and potentially destroy something.

Second question: Will this forcefully write zeros into unallocated space on rotating media? I know many (most?) SSDs will zero-detect at the flash translation layer thus “making note” of the zeros if not physically pushing them into the flash memory cells. But what about HDDs?

I’m asking from the standpoint of someone wanting to “secure wipe” every LBA on every disk that isn’t associated with actual data nor a snapshot. zpool trim might be helpful on a pool’s SSDs but it appears to accomplish nothing on spinning rust…

As I understand it (and I’m not Alan, or even staying at a hotel tonight) no, it will not overwrite good data.

FWIW, I tend to run this on every new pool I create, as a poor man’s disk check. I believe for spinning rust it will touch all the sectors involved once with a write, so that the drive firmware will have a chance to spot issues before real data gets put there.

I’d like to hear some one else’s opinion on whether my assumption of what happens is correct.

1 Like