add fsused to block_devices output

This commit is contained in:
Girish Ramakrishnan
2025-11-10 10:50:23 +01:00
parent d8c3ce30ca
commit 20d4ce6632
2 changed files with 3 additions and 2 deletions
+2 -1
View File
@@ -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)