3 ms·
I think that in the past I saw that when creating a file with e.g. ... dd if=/dev/zero of=deleteme.file bs=1M count=8196 ...the "free space" shown by "df" s
by zepearl 6y ago
I think that in the past I saw that when creating a file with e.g. ...
dd if=/dev/zero of=deleteme.file bs=1M count=8196
...the "free space" shown by "df" slowly decreased while the file was being created, but then once the operation completed that "free space" magically went back to its original value => the big existing file (full of "0"s) was basically not using any storage.
Is this what you mean?
I just tried to replicate this behaviour but, dammit, I cannot demonstrate that right now as the behaviour so far was the expected one (free storage decreasing when creating the file and sticking to that even after the completion of the operation).
I strongly believe that that's what I saw in the past (when I was preallocating image files to then be used by KVM VMs), but now I'm wondering if I'm imagining things... :P
EDIT: this happened when using ext4 and/or xfs (don't remember) without using any compression.
- tyingq 6y agodd will create sparse files if you use the seek option, like: dd if=/dev/zero of=a_sparse_file bs=1 count=0 seek=8G
- bombcar 6y agoYou have to beware if you're on a filesystem (such as ZFS) that has compression enabled. A file of all zeros compresses quite well, and may not get you the space you need when you remove it.
- zepearl 6y agoYep - but I think that I was using ext4 and/or xfs when I was seeing that happening... .
- zepearl 6y agoThank you. I actually never used that seek-option, but I still think that what I wrote did happen. Mistery... .