Re: zero filling a storage device (was: dd and mbr)
- Reply: Ralf Mardorf : "Re: zero filling a storage device (was: dd and mbr)"
- Reply: deleted: "deleted (X-No-Archive)"
- In reply to: deleted: "deleted (X-No-Archive)"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 14 Jan 2022 04:55:58 UTC
On Thursday, 13 January 2022 at 22:19:36 -0500, Kevin P. Neal wrote: > On Fri, Jan 14, 2022 at 01:30:02PM +1100, Greg 'groggy' Lehey wrote: >> On Thursday, 13 January 2022 at 17:26:12 -0800, David Christensen wrote: >>> If the program writes the buffer to the storage device starting at >>> block-aligned location P, where P + N * B <= M * B, will the storage >>> device write zero bytes to the storage device blocks that already >>> contain only zero bytes? >> >> Yes. The storage device doesn't know the current contents of the >> disk. To do so it would first have to read them, which takes far too >> long. >> >>> Is the answer different for a HDD, an SSD, a USB flash drive, an SD >>> card, a compact flash card, etc.? >> >> No. It's also not different for other operating systems. > > Are we certain that an SSD won't at least track that there is > nothing written to a logical block and therefore it must be all > zeros? We're talking about physical blocks here. I have to guess that you're thinking about the block remapping that SSDs do, but I've never heard them called "logical" and "physical". Writing all zeroes to a physical block and writing nothing to a physical block are two very different things. Writing nothing doesn't change anything. Writing zeroes to a block with content will change it. > I'm not 100% that an SSD will always keep a logical block assigned > to a physical block. And I'm not 100% certain that an SSD won't > notice that all zeros are being written to a block and just optimize > out the write. If I understand what you mean here, you're suggesting that SSDs may keep a list of zeroed-out blocks and just optimize them away? It's possible, though I haven't heard of it. I don't know how often blocks are completely zeroed out, but I suspect that it wouldn't be worth it. If they did, it would be a good advertisement, because it would indirectly increase the storage capacity of the SSD. Until proof of the contrary, I'd say "no, this doesn't happen". Greg -- Sent from my desktop computer. See complete headers for address and phone numbers. This message is digitally signed. If your Microsoft mail program reports problems, please read http://lemis.com/broken-MUA.php