diff --git a/controllers/utilsController.js b/controllers/utilsController.js index b0e1411..84d1033 100644 --- a/controllers/utilsController.js +++ b/controllers/utilsController.js @@ -746,7 +746,7 @@ self.stats = async (req, res, next) => { await new Promise((resolve, reject) => { const proc = spawn('df', [ '--block-size=1', - '--output=used,size', + '--output=size,avail', paths.uploads ]) @@ -764,9 +764,11 @@ self.stats = async (req, res, next) => { // Skip lines that have non-number chars if (columns.some(w => !/^\d+$/.test(w))) continue + const total = parseInt(columns[0]) + const avail = parseInt(columns[1]) stats.disk.drive = { - used: parseInt(columns[0]), - total: parseInt(columns[1]) + total, + used: total - avail } } }) diff --git a/src/js/dashboard.js b/src/js/dashboard.js index 35cb271..743640b 100644 --- a/src/js/dashboard.js +++ b/src/js/dashboard.js @@ -2860,7 +2860,7 @@ page.getStatistics = (params = {}) => { if ((types.byte || []).includes(valKeys[j])) parsed = page.getPrettyBytes(value) if ((types.byteUsage || []).includes(valKeys[j])) - parsed = `${page.getPrettyBytes(value.used)} / ${page.getPrettyBytes(value.total)} (${Math.round(value.used / value.total * 100)}%)` + parsed = `${page.getPrettyBytes(value.used)} / ${page.getPrettyBytes(value.total)} (${Math.floor(value.used / value.total * 100)}%)` if ((types.uptime || []).includes(valKeys[j])) parsed = page.getPrettyUptime(value)