diff --git a/dashboard/src/views/VolumesView.vue b/dashboard/src/views/VolumesView.vue index c59ff5c3f..490068338 100644 --- a/dashboard/src/views/VolumesView.vue +++ b/dashboard/src/views/VolumesView.vue @@ -163,7 +163,6 @@ async function openVolumeDialog(volume) { const ext4BlockDevices = [], xfsBlockDevices = []; for (const blockDevice of blockDevices) { - if (!blockDevice.mountpoint) continue; // only offer unmounted disks blockDevice.label = blockDevice.path; // // amend label for UI if (blockDevice.type === 'ext4') ext4BlockDevices.push(blockDevice); else if (blockDevice.type === 'xfs') xfsBlockDevices.push(blockDevice); diff --git a/src/routes/test/system-test.js b/src/routes/test/system-test.js index bac4f0b0b..b3a9a78c6 100644 --- a/src/routes/test/system-test.js +++ b/src/routes/test/system-test.js @@ -171,8 +171,8 @@ describe('System', function () { expect(response.status).to.equal(200); expect(response.body.devices).to.be.ok(); - expect(response.body.devices.some(d => d.mountpoint === '/')).to.be(true); - expect(response.body.devices.some(d => d.mountpoint === '/boot')).to.be(false); + expect(response.body.devices.some(d => d.mountpoints.includes('/'))).to.be(false); + expect(response.body.devices.some(d => d.mountpoints.includes('/boot'))).to.be(false); }); }); }); diff --git a/src/system.js b/src/system.js index af9d15fd5..e62ec17b1 100644 --- a/src/system.js +++ b/src/system.js @@ -319,22 +319,28 @@ 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 result = await shell.spawn('lsblk', ['--paths', '--json', '--list', '--fs', '--output', '+rota'], { encoding: 'utf8' }); - const info = safe.JSON.parse(result); + const output = await shell.spawn('lsblk', ['--paths', '--json', '--list', '--fs', '--output', '+rota'], { encoding: 'utf8' }); + const info = safe.JSON.parse(output); if (!info) throw new BoxError(BoxError.INTERNAL_ERROR, `failed to parse lsblk: ${safe.error.message}`); const devices = info.blockdevices.filter(d => d.fstype === 'ext4' || d.fstype === 'xfs'); - return devices.map(function (d) { - return { - path: d.name, - size: d.fsavail || 0, - type: d.fstype, - uuid: d.uuid, - rota: d.rota, // false (ssd) true (hdd) . unforuntately, this is not set correctly when virtualized (like in DO) - mountpoint: Array.isArray(d.mountpoints) ? d.mountpoints[d.mountpoints.length-1] : d.mountpoint // we only support one mountpoint here old lsblk only exposed one via .mountpoint - }; - }).filter(d => d.mountpoint !== '/boot'); + 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; + + result.push({ + path: device.name, + size: device.fsavail || 0, + type: device.fstype, + uuid: device.uuid, + rota: device.rota, // false (ssd) true (hdd) . unforuntately, this is not set correctly when virtualized (like in DO) + mountpoints + }); + } + + return result; } async function checkRebootRequired() {