Re: zero filling a storage device (was: dd and mbr)
- In reply to: Daniel Feenberg : "Re: zero filling a storage device (was: dd and mbr)"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 16 Jan 2022 00:08:24 UTC
On Friday, 14 January 2022 at 7:52:32 -0500, Daniel Feenberg wrote: > > Doesn't the filesystem code handle sparse files on its own? This man page: > > https://www.freebsd.org/cgi/man.cgi?du FWIW, it's easier to access this with 'man du'. > strongly implies that it does. A block of all zero bytes shouldn't > occupy hardly any disk space at all. Disk files are allocated in blocks. No data == no blocks. You can also write to a file, then lseek(1) to an address beyond the end of the file and write there. This will create a "sparse file": the intervening blocks will not be allocated. It's messy, though, because the allocation is by block, but writes don't need to adhere to block boundaries. 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