writing large files quickly

Grant Edwards grante at visi.com
Sat Jan 28 15:51:04 EST 2006


On 2006-01-28, Bengt Richter <bokr at oz.net> wrote:

>>Because it isn't really writing the zeros.   You can make these
>>files all day long and not run out of disk space, because this
>>kind of file doesn't take very many blocks.   The blocks that
>>were never written are virtual blocks, inasmuch as read() at
>>that location will cause the filesystem to return a block of NULs.
>
> I wonder if it will also "write" virtual blocks when it gets real
> zero blocks to write from a user, or even with file system copy utils?

No, in my experience none of the Linux filesystems do that.
It's easy enough to test:

$ dd if=/dev/zero of=zeros bs=64k count=1024
1024+0 records in
1024+0 records out
$ ls -l zeros
-rw-r--r--  1 grante users 67108864 Jan 28 14:49 zeros
$ du -h zeros
65M     zeros


In my book that's 64MB not 65MB, but that's an argument for
another day.

-- 
Grant Edwards                   grante             Yow!  It's the land of
                                  at               DONNY AND MARIE as promised
                               visi.com            in TV GUIDE!



More information about the Python-list mailing list