Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 Jan 2022 11:08:24 +1100
From:      Greg 'groggy' Lehey <grog@FreeBSD.org>
To:        Daniel Feenberg <feenberg@nber.org>
Cc:        "Kevin P. Neal" <kpn@neutralgood.org>, David Christensen <dpchrist@holgerdanske.com>, freebsd-questions@freebsd.org
Subject:   Re: zero filling a storage device (was: dd and mbr)
Message-ID:  <20220116000824.GT61872@eureka.lemis.com>
In-Reply-To: <a8c8e1b9-832d-6855-654-60cd1e5b38b@nber.org>
References:  <77680665-7ddb-23c5-e866-05d112339b60@holgerdanske.com> <20220114023002.GP61872@eureka.lemis.com> <YeDryNdYe1S20wd2@neutralgood.org> <a8c8e1b9-832d-6855-654-60cd1e5b38b@nber.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--9r3HF47jptiQlX4s
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

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

--9r3HF47jptiQlX4s
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iEYEARECAAYFAmHjYfgACgkQIubykFB6QiNwZQCfQrX7qq1a13eJPRJgi+t8kK+F
I7kAnj7Ojnee8/Qr+UpMeljtRy4LykcB
=dh2W
-----END PGP SIGNATURE-----

--9r3HF47jptiQlX4s--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20220116000824.GT61872>