openzfsonosx/zfs — pull request #199 by evansus (2014-06-21 18:58:16+00:00)
Title: Zvol unmap

@lundman, @ilovezfs
I'd like to open this up for discussion. This has been working well on my end for the past 4 weeks.

See [this comment] (https://github.com/openzfsonosx/zfs/commit/4660f7e069c58638f55c0c89e752b5a7bd780b79#commitcomment-6754584) on 4660f7e069c58638f55c0c89e752b5a7bd780b79 for comparison with other platforms.

Here's an example output from zfs list:
```
# zfs list -rt all zpm/zMacSSD
NAME USED AVAIL REFER MOUNTPOINT
zpm/zMacSSD 166G 325G 116G -
zpm/zMacSSD@backup-2014-05-23 9.70G - 128G -
zpm/zMacSSD@backup-2014-05-25 1.66G - 120G -
zpm/zMacSSD@backup-2014-05-27 7.20G - 129G -
zpm/zMacSSD@backup-2014-05-27-with-unmap 1.39G - 123G -
zpm/zMacSSD@backup-2014-05-31 2.18G - 114G -
zpm/zMacSSD@backup-2014-06-02 2.86G - 115G -
zpm/zMacSSD@backup-2014-06-12 3.24G - 116G -
zpm/zMacSSD@backup-2014-06-18 553M - 115G -
zpm/zMacSSD@backup-2014-06-19 1.14G - 116G -
zpm/zMacSSD@backup-2014-06-20 273M - 115G -
zpm/zMacSSD@backup-2014-06-21 0 - 116G -
```

As is hopefully evident, the space would change rapidly prior to adding unmap.

I was using Disk Utility's erase free space to cleanup every day or two, otherwise the space would continue to fill up to the volume size. This reclaimed 8gb between 05-23 and 05-25, but by 05-27 it had reached the same level.

Added unmap on 05-27 and ran erase free space one last time. I also removed some files from the volume, reaching 114G referenced. Since then the space hasn't fluctuated much.

Snapshots taken weekly or daily have smaller increments of used space, and the referenced space reflects deletions (naturally - without ever running erase free space).