I'm using ZFS snapshots to maintain access to historical versions of a backup filesystem.

fadedbee@backup:/backups$ sudo zfs list -t snapshot
NAME                       USED  AVAIL  REFER  MOUNTPOINT
bpool/backups@2018-06-01  96.8M      -  18.3G  -
bpool/backups@2018-06-18  96.8M      -  18.3G  -
bpool/backups@2018-06-19  96.8M      -  18.3G  -
bpool/backups@2018-06-20  96.4M      -  18.3G  -
bpool/backups@2018-06-21  96.2M      -  18.3G  -
bpool/backups@2018-06-22  63.3M      -  18.3G  -
bpool/backups@2018-06-23  62.1M      -  18.3G  -
bpool/backups@2018-06-24  62.1M      -  18.3G  -
bpool/backups@2018-06-25  96.1M      -  18.3G  -
bpool/backups@2018-06-26  96.0M      -  18.3G  -
bpool/backups@2018-06-27  97.1M      -  18.3G  -
bpool/backups@2018-06-28  96.2M      -  18.3G  -
bpool/backups@2018-06-29  62.7M      -  18.3G  -
bpool/backups@2018-06-30  63.4M      -  18.3G  -
bpool/backups@2018-07-01  63.0M      -  18.3G  -
bpool/backups@2018-07-02  96.5M      -  18.3G  -
bpool/backups@2018-07-03  96.6M      -  18.3G  -
bpool/backups@2018-07-04  96.2M      -  18.3G  -
bpool/backups@2018-07-05  96.7M      -  18.3G  -
bpool/backups@2018-07-06  62.5M      -  18.3G  -
bpool/backups@2018-07-07  62.8M      -  18.3G  -
bpool/backups@2018-07-08  63.9M      -  18.3G  -
bpool/backups@2018-07-09  97.3M      -  18.3G  -
bpool/backups@2018-07-10  96.3M      -  18.3G  -
bpool/backups@2018-07-11  97.6M      -  18.3G  -
bpool/backups@2018-07-12  98.3M      -  18.3G  -
bpool/backups@2018-07-13  63.1M      -  18.3G  -
bpool/backups@2018-07-14  62.6M      -  18.3G  -
bpool/backups@2018-07-15  63.3M      -  18.3G  -
bpool/backups@2018-07-16  97.5M      -  18.3G  -
bpool/backups@2018-07-17      0      -  18.3G  -
fadedbee@backup:/backups$ sudo zfs list
bpool          21.0G  3.49T    96K  /bpool
bpool/backups  21.0G  3.49T  18.3G  /backups

Are the USED sizes of these snapshots the size of difference between each snapshot and now? Or are they the size of difference between snapshots?

I know I could test this be deleting a snapshot, but it's not an important enough question to do this or set up a test scenario.

  • 1
    Another way to test might be to delete a large amount of data from the filesystem and see what changes occur to the USED and REFER columns – Andrew Henle Jul 19 '18 at 12:05

From the zfs manpage:

When snapshots (see the "Snapshots" section) are created, their 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 counted in the snapshot's space used. Additionally, deleting snap- shots can increase the amount of space unique to (and used by) other snapshots.

So the USED column in the zfs list output does not reflect the difference between that snapshot and some other snapshot or the dataset, but rather specifically to the data that is uniquely referenced by that snapshot.

This means that, for example, if two snapshots refer to the same 100MB file, which is deleted from the main dataset, this will not be reflected in the USED column of either snapshot. If one of the snapshots is deleted, it will then show in the USED column for the other snapshot; since it's now the only snapshot which refers to that file.

An easy way to think about it is that the USED column shows how much space would be made free if that dataset or snapshot was deleted.

  • So, if two snapshots refer to the same 100MB file, which is not in the main dataset, its size does not show up in used for any snapshot or dataset? – fadedbee Aug 6 '18 at 19:14
  • 1
    @fadedbee It will show in the USED column for the dataset itself, but not for the snapshots. So you'd see 100MB for the dataset, and a few KB for each snapshot. – Mikolan Aug 7 '18 at 20:11
  • Thanks, that's what I didn't understand. – fadedbee Aug 12 '18 at 11:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.