system: return the mounted and unmounted block devices (as long as xfs or ext4)
This commit is contained in:
+4
-3
@@ -327,13 +327,14 @@ async function getBlockDevices() {
|
||||
|
||||
const result = [];
|
||||
for (const device of devices) {
|
||||
const mountpoints = Array.isArray(device.mountpoints) ? device.mountpoints : [ device.mountpoint ]; // we only support one mountpoint here old lsblk only exposed one via .mountpoint
|
||||
if (mountpoints.includes('/') || mountpoints.includes('/boot')) continue; // cannot be used for backups and volumes
|
||||
const mountpoints = Array.isArray(device.mountpoints)
|
||||
? (device.mountpoints[0] === null ? [] : device.mountpoints) // convert [ null ] to []
|
||||
: (device.mountpoint ? [ device.mountpoint ] : []); // old lsblk only exposed one .mountpoint
|
||||
|
||||
result.push({
|
||||
path: device.name,
|
||||
size: device.fsavail || 0,
|
||||
type: device.fstype,
|
||||
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)
|
||||
mountpoints
|
||||
|
||||
Reference in New Issue
Block a user