yet-another-bench-script
yet-another-bench-script copied to clipboard
ZFS free space calculation when there are multiple datasets under the same path
I have the following zpool:
NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
cache 222G 67.4G 155G - - 0% 30% 1.00x ONLINE -
with the following datasets:
cache 67.4G 148G 60.6G /mnt/cache
cache/appdata 1.72G 148G 1.61G /mnt/cache/appdata
cache/domains 96K 148G 96K /mnt/cache/domains
cache/system 5.10G 148G 5.07G /mnt/cache/system
I run YABS on /mnt/cache
and encounter the following error:
bash: line 545: ((: 148G: value too great for base (error token is "148G")
The script continues normally afterwards. The issue is that free_space
(https://github.com/masonr/yet-another-bench-script/blob/a18e1bcd60f5ab9e3640c650726d8949b7bb5bfe/yabs.sh#L535C3-L535C85) receives the following data:
148G
148G
148G
148
This is because the grep
matches all entries. Perhaps a fix would be to also pipe head -n 1
or stricter grep
arguments.