diff --git a/src/system.js b/src/system.js index da03105c0..eb4a996fb 100644 --- a/src/system.js +++ b/src/system.js @@ -62,8 +62,10 @@ async function getDisks() { const disks = {}; // by file system let rootDisk; + const DISK_TYPES = [ 'ext4', 'xfs', 'cifs', 'nfs', 'fuse.sshfs' ]; // we don't show size of contents in untracked disk types + for (const disk of dfEntries) { - if (disk.type !== 'ext4' && disk.type !== 'xfs') continue; + if (!DISK_TYPES.includes(disk.type)) continue; if (disk.mountpoint === '/') rootDisk = disk; disks[disk.filesystem] = { filesystem: disk.filesystem, @@ -92,18 +94,21 @@ async function getDisks() { const backupConfig = await settings.getBackupConfig(); if (backupConfig.provider === 'filesystem') { const [, dfResult] = await safe(df.file(backupConfig.backupFolder)); - disks[dfResult?.filesystem || rootDisk.filesystem].contents.push({ type: 'standard', id: 'cloudron-backup', path: backupConfig.backupFolder }); + const filesystem = dfResult?.filesystem || rootDisk.filesystem; + if (disks[filesystem]) disks[filesystem].contents.push({ type: 'standard', id: 'cloudron-backup', path: backupConfig.backupFolder }); } const [dockerError, dockerInfo] = await safe(docker.info()); if (!dockerError) { const [, dfResult] = await safe(df.file(dockerInfo.DockerRootDir)); - disks[dfResult?.filesystem || rootDisk.filesystem].contents.push({ type: 'standard', id: 'docker', path: dockerInfo.DockerRootDir }); + const filesystem = dfResult?.filesystem || rootDisk.filesystem; + if (disks[filesystem]) disks[filesystem].contents.push({ type: 'standard', id: 'docker', path: dockerInfo.DockerRootDir }); } for (const volume of await volumes.list()) { const [, dfResult] = await safe(df.file(volume.hostPath)); - disks[dfResult?.filesystem || rootDisk.filesystem].contents.push({ type: 'volume', id: volume.id, path: volume.hostPath }); + const filesystem = dfResult?.filesystem || rootDisk.filesystem; + if (disks[filesystem]) disks[filesystem].contents.push({ type: 'volume', id: volume.id, path: volume.hostPath }); } for (const app of await apps.list()) { @@ -111,7 +116,8 @@ async function getDisks() { const dataDir = await apps.getStorageDir(app); const [, dfResult] = await safe(df.file(dataDir)); - disks[dfResult?.filesystem || rootDisk.filesystem].contents.push({ type: 'app', id: app.id, path: dataDir }); + const filesystem = dfResult?.filesystem || rootDisk.filesystem; + if (disks[filesystem]) disks[filesystem].contents.push({ type: 'app', id: app.id, path: dataDir }); } const swaps = await getSwaps();