OS X will create sparse files across NFS, or does it?

KinMage:src thomas$ sudo mount -o vers=3,intr 172.16.1.129:/fooper /mnt
KinMage:src thomas$ ls -la /mnt
total 8
drwxrwxrwx   2 root  wheel  4096 Feb 13 21:50 .
drwxrwxr-t  24 root  admin  1224 Feb 13 21:54 ..

Where 172.16.1.129 is snakey, the Linux VM I am using for testing.

And then:

KinMage:mnt thomas$ python punch.py 
KinMage:mnt thomas$ ls -la p*out
-rw-r--r--  1 thomas  staff    1023 Feb 13 21:54 p1023.out
-rw-r--r--  1 thomas  staff    1024 Feb 13 21:54 p1024.out
-rw-r--r--  1 thomas  staff    1025 Feb 13 21:54 p1025.out
-rw-r--r--  1 thomas  staff   10250 Feb 13 21:54 p10250.out
-rw-r--r--  1 thomas  staff  102500 Feb 13 21:54 p102500.out
-rw-r--r--  1 thomas  staff      64 Feb 13 21:54 p64.out
KinMage:mnt thomas$ du -sh p*out
1.0K	p1023.out
1.0K	p1024.out
1.5K	p1025.out
 10K	p10250.out
100K	p102500.out
512B	p64.out

So it creates sparse files across NFS!

Well, yes and no. It will only send a block of data across and then the
server OS decides to create the sparse file or not.

Another thing to note is that the size reported is flexible in the sense
that the underlying file system interface determines how much space
is being reported:

[thomas@snakey fooper]$ du -sh p*out
4.0K	p1023.out
4.0K	p1024.out
4.0K	p102500.out
4.0K	p10250.out
4.0K	p1025.out
4.0K	p64.out

Ideally we would like the sizes to match, but since we are pulling a fast one, we get what we see.

Share