Sunday, April 26, 2015

Limiting the size of a ZFS filesystem

And here is another quickie:

So, you created a zfs filesystem and realized you forgot to size it, or at least limit how much space in the pool it can use:

# df -h
[...]
storagepool/hosts/scan
                        67G    20K    63G     1%    /export/hosts/scan
storagepool/hosts/scan/local
                        67G    18K    63G     1%    /export/hosts/scan/local
#

Fear not for we have a way around it. Doesn't it look like we want to put a quota on that filesystem? If so, why not use the quota option in the zfs set command?

# zfs set quota=4G storagepool/hosts/scan
# df -h
[...]
storagepool/hosts/scan
                       4.0G    20K   4.0G     1%    /export/hosts/scan
storagepool/hosts/scan/local
                       4.0G    18K   4.0G     1%    /export/hosts/scan/local
#

Note that storagepool/hosts/scan/local, which is inside storagepool/hosts/scan, was also resized.

References

Setting Quotas on ZFS File Systems

No comments: