Skip to content

Invalid ZFS filesystem size detection #118

@lolmens

Description

@lolmens

Hey!
A`m bench LXC container and found some issue.

My set up ubuntu-24.04-standard_24.04-2_amd64.tar.zst

root@ubuntu:/mnt/disk# uname -a
Linux ubuntu 6.17.2-1-pve #1 SMP PREEMPT_DYNAMIC PMX 6.17.2-1 (2025-10-21T11:55Z) x86_64 x86_64 x86_64 GNU/Linux

root@ubuntu:/mnt/disk# df -Th
Filesystem                   Type      Size  Used Avail Use% Mounted on
rpool/data/subvol-104-disk-0 zfs       8.0G  443M  7.6G   6% /
rpool/data/subvol-104-disk-1 zfs        60G  128K   60G   1% /mnt/disk
none                         tmpfs     492K  4.0K  488K   1% /dev
efivarfs                     efivarfs  128K   50K   74K  41% /sys/firmware/efi/efivars
tmpfs                        tmpfs      31G     0   31G   0% /dev/shm
tmpfs                        tmpfs      13G  120K   13G   1% /run
tmpfs                        tmpfs     5.0M     0  5.0M   0% /run/lock
tmpfs                        tmpfs     6.1G  8.0K  6.1G   1% /run/user/0

Start yabs from from /mnt/disk folder.

root@ubuntu:/mnt/disk# ./yabs.sh -i -g -n
# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #
#              Yet-Another-Bench-Script              #
#                     v2025-04-20                    #
# https://github.com/masonr/yet-another-bench-script #
# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #

Wed Jan 14 15:26:32 UTC 2026

Basic System Information:
---------------------------------
Uptime     : 0 days, 0 hours, 10 minutes
Processor  : AMD Ryzen 9 9955HX 16-Core Processor
CPU cores  : 1 @ 4752.912 MHz
AES-NI     : ✔ Enabled
VM-x/AMD-V : ✔ Enabled
RAM        : 512.0 MiB
Swap       : 0.0 KiB
Disk       : 
Distro     : Ubuntu 24.04 LTS
Kernel     : 6.17.2-1-pve
VM Type    : LXC
IPv4/IPv6  : ✔ Online / ❌ Offline

Warning! You are running YABS on a ZFS Filesystem and your disk space is too low for the fio test. Your test results will be inaccurate. You need at least 48 GB free in order to complete this test accurately. For more information, please see https://github.com/masonr/yet-another-bench-script/issues/13

But my partition is 60G. Let's check, run part of the script.

root@ubuntu:/mnt/disk# poss=()

    # Find relevant filesystem paths that are parent directories or the current directory itself
    for pathls in $(df -Th | awk '{print $7}' | tail -n +2)
    do
        # Check if PWD starts with (is a subdirectory of or same as) pathls
        if [[ "${PWD}" == "${pathls}"* ]]; then
            poss+=("$pathls")
        fi
    done

    long=""
    m=-1 # Initialize max length to -1 to ensure the first valid path is picked
    # Select the longest matching path from the 'poss' array
    # This ensures we get the most specific mounted point for the current directory
    for x in "${poss[@]}"
    do
        if [ "${#x}" -gt "$m" ];then
            m=${#x}
            long=$x
        fi
    done
root@ubuntu:/mnt/disk# echo $long
/mnt/disk # Looks OK

root@ubuntu:/mnt/disk# avail_space_with_unit=$(df -Th | grep -w "$long" | awk '$2 == "zfs" {print $4; exit}')
root@ubuntu:/mnt/disk# echo $avail_space_with_unit
128K # Looks wrong, it's used space. 

Try to fix it change $4 -> $5

root@ubuntu:/mnt/disk# avail_space_with_unit=$(df -Th | grep -w "$long" | awk '$2 == "zfs" {print $5; exit}')
root@ubuntu:/mnt/disk# echo $avail_space_with_unit
60G # More better

Try run script - successfully!

./yabs.sh -i -g -n
... Header same as previous ... 
fio Disk Speed Tests (Mixed R/W 50/50) (Partition rpool/data/subvol-104-disk-1):
---------------------------------
Block Size | 4k            (IOPS) | 64k           (IOPS)
  ------   | ---            ----  | ----           ---- 
Read       | 56.66 MB/s   (14.1k) | 592.70 MB/s   (9.2k)
Write      | 56.75 MB/s   (14.1k) | 595.82 MB/s   (9.3k)
Total      | 113.41 MB/s  (28.3k) | 1.18 GB/s    (18.5k)
           |                      |                     
Block Size | 512k          (IOPS) | 1m            (IOPS)
  ------   | ---            ----  | ----           ---- 
Read       | 786.93 MB/s   (1.5k) | 934.42 MB/s    (912)
Write      | 828.74 MB/s   (1.6k) | 996.65 MB/s    (973)
Total      | 1.61 GB/s     (3.1k) | 1.93 GB/s     (1.8k)

YABS completed in 44 sec

I don't know why or when df changed column count. This is my utils versions:

root@ubuntu:/mnt/disk# df --version
df (GNU coreutils) 9.4
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Torbjörn Granlund, David MacKenzie, and Paul Eggert.

root@ubuntu:/mnt/disk# apt show coreutils
Package: coreutils
Version: 9.4-3ubuntu6.1
Priority: required
Essential: yes
Section: utils
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Michael Stone <mstone@debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 7111 kB
Pre-Depends: libacl1 (>= 2.2.23), libattr1 (>= 1:2.4.48), libc6 (>= 2.38), libgmp10 (>= 2:6.3.0+dfsg), libselinux1 (>= 3.1~), libssl3t64 (>= 3.0.0)
Breaks: usrmerge (<< 39)
Homepage: http://gnu.org/software/coreutils
Task: minimal, server-minimal
Download-Size: 1413 kB
APT-Sources: http://archive.ubuntu.com/ubuntu noble-updates/main amd64 Packages
Description: GNU core utilities
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions