Sunday, 21 October 2018

How to find the space consumed by ZFS snapshots By Devan

How to find the space consumed by ZFS snapshots

When a snapshot is created, its space is initially shared between the snapshot and the file system, and possibly with previous snapshots. As the file system changes, space that was previously shared becomes unique to the snapshot, and thus is counted in the snapshot’s used property.
Additionally, deleting snapshots can increase the amount of space that is unique for use by other snapshots.
Note: The value for a snapshot’s space referenced property is the same as that for the file system when the snapshot was created.

Snapshot Space Accounting

You can display the amount of space that is consumed by snapshots and descendant file systems by using the zfs list -o space command (as in the example below).
You can enable or disable the display of snapshot listings in the zfs list output by using the listsnapshots pool property. This property is disabled by default. To enable this property, use zpool set listsnapshots=on, followed by the pool name. For example :
# zpool set listsnapshots=on rpool
# zfs list -o space -r rpool
NAME                             AVAIL   USED  USEDSNAP  USEDDS  USEDREFRESERV  USEDCHILD
rpool                            10.2G  5.16G         0   4.52M              0      5.15G
rpool/ROOT                       10.2G  3.06G         0     31K              0      3.06G
rpool/ROOT/solaris               10.2G  3.06G     55.0M   2.78G              0       224M
rpool/ROOT/solaris@install           -  55.0M         -       -              -          -
rpool/ROOT/solaris/var           10.2G   224M     2.51M    221M              0          0
rpool/ROOT/solaris/var@install       -  2.51M         -       -              -          -
rpool/VARSHARE                   10.2G  2.52M         0   2.43M              0        94K
rpool/VARSHARE/pkg               10.2G    63K         0     32K              0        31K
rpool/VARSHARE/pkg/repositories  10.2G    31K         0     31K              0          0
rpool/VARSHARE/zones             10.2G    31K         0     31K              0          0
rpool/dump                       10.3G  1.03G         0   1.00G          32.5M          0
rpool/export                     10.2G  30.1M         0     32K              0      30.1M
rpool/export/home                10.2G  30.1M         0     32K              0      30.1M
rpool/export/home@friday             -      0         -       -              -          -
rpool/export/home/geek           10.2G  30.1M       20K   30.0M              0          0
rpool/export/home/geek@2days         -    20K         -       -              -          -
rpool/swap                       10.3G  1.03G         0   1.00G          32.5M          0
From this output, you can see the amount of space that is:
  • Available on each file system
  • Being used
  • Being consumed by snapshots of each data set (USEDSNAP)
  • Being used by the data set itself (USEDDS)
  • Being used by a refreservation set on the data set (USED REFRESERV)
  • Being used by the children of this data set (USEDCHILD)

No comments:

Post a Comment