Calculating snapshot size

Hi,
is there possibility to monitor disk space usage by snapshots? Eg. I need to know how much space took last created snapshot or how much space is used by all snapshots of one particular container.

Best regards,
Tomasz Prus

It’s not something we currently expose (will add to our backlog though) but also will be quite tricky on some of the backends that use copy-on-write (pretty much everything except dir) as the size of the snapshot is directly related to the previous snapshots and delta to current state.

Ok, I understand… Maybe, any advise how can I monitor disk usage per one particular container and all data referenced to it like snapshots? I’d like to set limit to users of my application and allow them creating snapshots but within some limits.

If you’re using ZFS, I believe using refquota (configurable through LXD) effectively causes the snapshots to be included in the total amount of space for the dataset.

btrfs

Ah, btrfs is a funny one because the quota (and accounting) tree is separate from the subvol tree, so that doesn’t really give you a great way to track this.

There’s also the giant quota issue in btrfs that anyone can bypass their quota by just creating an empty subvolume (which all unprivileged users can do).