space: disk, WAL, databases
Captured on 2026-10-07 (UTC+08) on a local KingbaseES V008R006C009B0014 primary and standby, database test, using ~/kbdiag built from Go source commit 96c874f (static linux/amd64 binary). This is lab evidence, not production validation. Everything here comes from the healthy lab and from two accounts that cannot see everything: kbdiag_ro (no monitoring role) over 127.0.0.1, and kbdiag_ro over the node’s network address. No fault was injected for this command. The one FAIL it can report was not produced in the lab (see the last section). Values belong to this capture only.
Usage
No options of its own. Connection options are the same as for sessions.
Healthy primary
disklists the filesystems that hold the data directory, the WAL directory and the tablespaces, with directories on the same filesystem merged into one row (by device number, so asys_walthat is a symlink to another disk shows up as its own row).freeis what a non-root user such askingbasecan use. It reads the disk with statfs, so it works only when kbdiag runs on the database host (see “Remote connection” below).walis the size ofsys_wal, set besidemax_wal_sizeandwal_keep_segments(shown as the size it keeps: 512 x 16 MB). kbdiag does not judge it:max_wal_sizeis a soft limit, and PG12 normally keeps about the sum of both plus the WAL written since the last checkpoint, so exceeding only one of them is normal. Whensys_walis above that sum, the text points you tokbdiag slotsandkbdiag archive. Here 3248 MB is below 1024 + 8192 MB.databasesreuses the same probe asstatus, so the numbers matchstatus.tablespaceslists each one with its location (in data_directoryfor the default ones).
Standby
A standby is judged the same way. Its WAL directory is its own, so the file count and size differ from the primary’s.
Without privileges
kbdiag_ro has no monitoring role. It connects over 127.0.0.1, which is TCP (hence kbdiag_ro@remote in the first line), but the database is on this host, so the disk can still be read:
wal: skipped:sys_ls_waldiris not allowed for this account, so the WAL size is not collected.spaceis a display command, so any probe that is not collected makes the verdict UNKNOWN instead of OK: OK would only mean “everything was collected”, and here it was not.?in the tablespace table means this account cannot see that size (pg_tablespace_size(sys_global)is denied). kbdiag wraps the call in a CASE, so only those cells are NULL and the rest of the statement still runs; the cells are listed inredacted. Grantingsys_monitorlifts both.
Remote connection
Over the node’s network address the data directory may be on another machine than the one you are looking at, so kbdiag does not read a disk:
disk: not_applicable (remote connection). kbdiag reads the disk only when it is certain to run on the database host: a Unix socket, or a host oflocalhost,127.0.0.1or::1with thedata_directorypresent locally. A forwarded port could lead to another machine, so the host name alone is not enough.not_applicableis not a failure, but with the privilege gaps above the verdict is UNKNOWN here too.
The FAIL that was not produced
Not produced in the lab, taken from the source: space.disk_full (FAIL). It reports a filesystem holding the data directory or the WAL directory whose free space is less than one WAL segment (16 MB here). Making it appear needs the data disk to be really filled, which the lab does not do.
- On the WAL disk no new segment can be created, so the server stops once no old segment is left to reuse. On the data directory’s disk, tables, transaction status files and temp files are about to fail to grow (these are ERRORs; the instance does not stop). The finding says which applies.
- Strictly it is “about to be affected”, and kbdiag reports it as FAIL because there is one segment of room left and no margin to keep watching.
- Free space on other disks (a tablespace) or “low but more than a segment” depends on the database, so it is only shown.
- One finding per filesystem. The segment size comes from the
walprobe, so when it is not collected (as forkbdiag_ro) this rule does not judge.
The status command’s inst.disk is a shorter, display-only view of the data directory’s disk.
Exit codes
| Code | Meaning |
|---|---|
| 0 | OK |
| 2 | FAIL: a filesystem has less free space than one WAL segment (not produced in the lab) |
| 3 | UNKNOWN: data not collected or not visible |
| 64 | Usage error |
| 69 | Cannot connect |