To amplify what Mike says...

On Jul 10, 2012, at 5:54 AM, Mike Gerdts wrote:
> ls(1) tells you how much data is in the file - that is, how many bytes
> of data that an application will see if it reads the whole file.
> du(1) tells you how many disk blocks are used.  If you look at the
> stat structure in stat(2), ls reports st_size, du reports st_blocks.
> 
> Blocks full of zeros are special to zfs compression - it recognizes
> them and stores no data.  Thus, a file that contains only zeros will
> only require enough space to hold the file metadata.
> 
> $ zfs list -o compression ./
> COMPRESS
>      on
> 
> $ dd if=/dev/zero of=1gig count=1024 bs=1024k
> 1024+0 records in
> 1024+0 records out
> 
> $ ls -l 1gig
> -rw-r--r--   1 mgerdts  staff    1073741824 Jul 10 07:52 1gig

"ls -ls" shows the length (as in -l) and size (as in -s, units="blocks")
So you can see that it takes only space for metadata.
   1 -rw-r--r--   1 root     root     1073741824 Nov 26 06:52 1gig
size ................................ length


 -- richard

--
ZFS Performance and Training
richard.ell...@richardelling.com
+1-760-896-4422







_______________________________________________
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss

Reply via email to