1

I'm trying to understand the difference between the sparse file and no-sparse using the following article http://extrabright.com/blog/2010/03/30/how-to-know-if-a-file-on-linux-is-sparse/

I also created the sparse file http://prefetch.net/blog/index.php/2009/07/05/creating-sparse-files-on-linux-hosts-with-dd/ as mention over here.

But every time I create a file I see the block size to be equal to the actual size of the file (of the above sparse file create)

dd if=/dev/zero of=xen-guest.img bs=1 count=0 seek=1G

then using ls command to verify if the file is sparse file

ls -alshk
1.0G -rw-r--r--  1 ratatouille staff 1.0G Apr 17 08:48 xen-guest.img

Can someone explain me what I'm missing over here.

Note: the OS is MAC-OS 10.12.3 and the above stuff works properly in Ubuntu.

Ratatouille
  • 1,372
  • 5
  • 23
  • 50
  • This is marked as duplicate but duplicate is wrong (it's about C API). I can't add answer here because of this. APFS supports sparse files and `dd` command with `seek` successfully creates sparse files in this FS. Tried on Mac OS 10.13.4. – kolen May 22 '18 at 20:29

1 Answers1

2

macOS with the HFS+ file system does not support sparse files. See also https://stackoverflow.com/a/186098

Community
  • 1
  • 1
faffaffaff
  • 3,429
  • 16
  • 27