From 20d4ce663242295733fd416c60ed01f609e047fd Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Mon, 10 Nov 2025 10:50:23 +0100 Subject: [PATCH] add fsused to block_devices output --- src/routes/system.js | 2 +- src/system.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/routes/system.js b/src/routes/system.js index a1b643637..af4226160 100644 --- a/src/routes/system.js +++ b/src/routes/system.js @@ -170,7 +170,7 @@ async function getFilesystems(req, res, next) { } async function getFilesystemUsage(req, res, next) { - if (typeof req.query.filesystem !== 'string') return next(new HttpError(400, 'getFilesystemUsage')); + if (typeof req.query.filesystem !== 'string') return next(new HttpError(400, 'Missing filesystem query param')); if (req.headers.accept !== 'text/event-stream') return next(new HttpError(400, 'This API call requires EventStream')); const [error, task] = await safe(system.getFilesystemUsage(req.query.filesystem)); diff --git a/src/system.js b/src/system.js index 56d448225..8d0cb7c50 100644 --- a/src/system.js +++ b/src/system.js @@ -324,7 +324,7 @@ async function getLogs(unit, options) { // this gets block devices as opposed to mounted filesystems. this is used for configuring backups and volumes in the frontend async function getBlockDevices() { - const output = await shell.spawn('lsblk', ['--paths', '--json', '--list', '--fs', '--output', '+rota'], { encoding: 'utf8' }); + const output = await shell.spawn('lsblk', ['--paths', '--bytes', '--json', '--list', '--fs', '--output', '+rota,fsused,fsavail'], { encoding: 'utf8' }); const info = safe.JSON.parse(output); if (!info) throw new BoxError(BoxError.INTERNAL_ERROR, `failed to parse lsblk: ${safe.error.message}`); @@ -340,6 +340,7 @@ async function getBlockDevices() { result.push({ path: device.name, size: device.fsavail || 0, + used: device.fsused || 0, type: device.fstype, // when null, it is not formatted uuid: device.uuid, rota: device.rota, // false (ssd) true (hdd) . unforuntately, this is not set correctly when virtualized (like in DO)