diff options
Diffstat (limited to 'lib/data.lua')
| -rw-r--r-- | lib/data.lua | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/data.lua b/lib/data.lua index d5203a8..98c6898 100644 --- a/lib/data.lua +++ b/lib/data.lua @@ -219,7 +219,8 @@ function M.df_parse(text) for line in text:gmatch('[^\n]+') do -- A data row ends in 'NN% /some/path'. The header ends in 'Mounted on', -- which fails the percent match, so it is skipped without a special case. - local size, used, pct, mount = line:match('(%d+)%s+(%d+)%s+%d+%s+(%d+)%%%s+(%S+)%s*$') + local size, used, avail, pct, mount = + line:match('(%d+)%s+(%d+)%s+(%d+)%s+(%d+)%%%s+(%S+)%s*$') if size then -- The device is kept so a caller can tell an NFS mount from a local one -- and recover its server, which is how the disks card labels the two @@ -231,6 +232,10 @@ function M.df_parse(text) host = dev and dev:match('^([^/:]+):') or nil, size = tonumber(size), used = tonumber(used), + -- Read, not derived: size - used overstates free space by the + -- root-reserved blocks, which is tens of gigabytes on a large + -- filesystem and is not available to anyone but root. + avail = tonumber(avail), pct = tonumber(pct), } end |
