Only list ext4 block devices

This commit is contained in:
Johannes Zellner
2023-01-23 19:45:16 +01:00
parent b2d072f2e6
commit 8298e26881

View File

@@ -339,14 +339,14 @@ async function getBlockDevices() {
let info;
try {
info = JSON.parse(execSync('lsblk --paths --json --list --bytes', { encoding: 'utf8' }));
info = JSON.parse(execSync('lsblk --paths --json --list --fs', { encoding: 'utf8' }));
} catch (e) {
console.error('Failed to list disks:', e);
throw new BoxError(BoxError.INTERNAL_ERROR, e);
}
// remove empty disks (disks with partitions)
const devices = info.blockdevices.filter(d => d.size);
// filter only for ext4 disks
const devices = info.blockdevices.filter(d => d.fstype === 'ext4');
debug(`getBlockDevices: Found ${devices.length} devices. ${devices.map(d => d.name).join(', ')}`);