Sparse file creation not an option on OS X

We can see that when we try to create a sparse file a file under OS X (10.6) that the OS writes out the intervening pages.

KinMage:src thomas$ uname -a
Darwin KinMage 10.6.0 Darwin Kernel Version 10.6.0: Wed Nov 10 18:13:17 PST 2010; root:xnu-1504.9.26~3/RELEASE_I386 i386
KinMage:src thomas$ python 
KinMage:src thomas$ ls -la p*out
-rw-r--r--  1 thomas  staff    1023 Feb 13 21:44 p1023.out
-rw-r--r--  1 thomas  staff    1024 Feb 13 21:44 p1024.out
-rw-r--r--  1 thomas  staff    1025 Feb 13 21:44 p1025.out
-rw-r--r--  1 thomas  staff   10250 Feb 13 21:44 p10250.out
-rw-r--r--  1 thomas  staff  102500 Feb 13 21:44 p102500.out
-rw-r--r--  1 thomas  staff      64 Feb 13 21:44 p64.out
KinMage:src thomas$ du -sh p*out
4.0K	p1023.out
4.0K	p1024.out
4.0K	p1025.out
 12K	p10250.out
104K	p102500.out
4.0K	p64.out

They should all be a multiple of a block size if there are sparse files. Since
they are not, we can conclude no sparse files were created.

Hmm, I wonder what happens over NFS?

Leave a Reply