Cindy Swearingen <cindy.swearin...@oracle.com> writes:

> Hi Harry,
>
> Both du and df are pre-ZFS commands and don't really understand ZFS
> space issues, which are described in the ZFS FAQ here:
>
> http://hub.opensolaris.org/bin/view/Community+Group+zfs/faq
>
> Why does du(1) report different file sizes for ZFS and UFS? Why doesn't
> the space consumption that is reported by the df command and the zfs
> list command match?
>
> Will's advice is good:
>
> Use zpool list and zfs list to determine how much space is available
> for your ZFS file systems and use du or ls -l to review file
> sizes. Don't
> use du or df to look at ZFS file systems sizes.
>
I think I'm beginning to see how this goes.  And at risk of sounding
like a total idiot I notice the information below:

  zfs list z2/rhosts/imgs/harvey

  NAME                    USED  AVAIL  REFER  MOUNTPOINT
  z2/rhosts/imgs/harvey   150G  90.7G  17.6G  /rhosts/imgs/harvey

Its wasn't clear (to me) really what REFER means... according to
`man zfs':
 
    [...]  
    referenced

         The amount of data that is accessible by  this  dataset,
         which  may  or  may not be shared with other datasets in
         the pool. When a snapshot or clone is created,  it  ini-
         tially  references  the same amount of space as the file
         system or snapshot it was created from, since  its  con-
         tents are identical.

         This property can also be referred to by  its  shortened
         column name, refer.

So apparently it means that even though 150 GB are used, only 17.6G
can be accessed.

Now du -sh on the same data:

# /bin/du -sh /rhosts/imgs/harvey
  46G   /rhosts/imgs/harvey

That is 300+ % less.

But then if you examine the [...].zfs/snapshot directory... you find
the data... or I guess its really the possible data.

  pwd
  /rhosts/imgs/harvey/.zfs/snapshot

du -sh `ls`
  18G     zfs-auto-snap:frequent-2010-04-18-03:15
  18G     zfs-auto-snap:frequent-2010-04-18-16:30
  18G     zfs-auto-snap:frequent-2010-04-18-18:45
  18G     zfs-auto-snap:frequent-2010-04-20-07:15
  18G     zfs-auto-snap:monthly-2010-04-01-00:00
  18G     zfs-auto-snap:weekly-2010-03-22-00:00
  18G     zfs-auto-snap:weekly-2010-03-29-00:00
  18G     zfs-auto-snap:weekly-2010-04-08-00:00
  18G     zfs-auto-snap:weekly-2010-04-15-00:00
 =====
  162GB

-------        ---------       ---=---       ---------      -------- 

So then it seems some careful attention must be paid to the snapshots,
especially when you've removed quite a lot of data from the zfs
filesystem above them.

If you really want the space back now you'll need to follow up by
removing the data from the snapshots too.  Instead of letting the
rollover of snapshots, eventually square with the data above them.

Or I guess if you feel lucky and don't think there will be a need for
that removed data you could remove all the snapshots and let the first
new one happen.

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

Reply via email to