Skip to content

Project NOMAD is an offline-first knowledge and education server. Wikipedia, thousands of books, courses, maps, and optional local AI, all running on hardware you own with no internet required.

TypeScript

fix: prefer real block devices over tmpfs for storage display

Andrew Barnesd53ccd2dc8a6
diff --git a/admin/inertia/pages/easy-setup/index.tsx b/admin/inertia/pages/easy-setup/index.tsx
index 5e976c1e..9c7ca9fb 100644
--- a/admin/inertia/pages/easy-setup/index.tsx
+++ b/admin/inertia/pages/easy-setup/index.tsx
@@ -318,7 +318,19 @@ export default function EasySetupWizard(props: { system: { services: ServiceSlim
}
const primaryDisk = getPrimaryDisk()
- const primaryFs = systemInfo?.fsSize?.[0]
+ // When falling back to fsSize (systeminformation), prefer real block devices
+ // over virtual filesystems like tmpfs which report misleading capacity.
+ const getPrimaryFs = () => {
+ if (!systemInfo?.fsSize || systemInfo.fsSize.length === 0) return null
+ const realDevices = systemInfo.fsSize.filter((fs) => fs.fs.startsWith('/dev/'))
+ if (realDevices.length > 0) {
+ return realDevices.reduce((largest, current) =>
+ current.size > largest.size ? current : largest
+ )
+ }
+ return systemInfo.fsSize[0]
+ }
+ const primaryFs = getPrimaryFs()
const storageInfo = primaryDisk
? { totalSize: primaryDisk.totalSize, totalUsed: primaryDisk.totalUsed }
: primaryFs
diff --git a/install/sidecar-disk-collector/collect-disk-info.sh b/install/sidecar-disk-collector/collect-disk-info.sh
index 09927d58..ec550c18 100755
--- a/install/sidecar-disk-collector/collect-disk-info.sh
+++ b/install/sidecar-disk-collector/collect-disk-info.sh
@@ -50,6 +50,22 @@ while true; do
FS_JSON+="{\"fs\":\"${dev}\",\"size\":${size},\"used\":${used},\"available\":${avail},\"use\":${pct},\"mount\":\"${mountpoint}\"}"
FIRST=0
done < /host/proc/1/mounts
+
+ # Fallback: if no real filesystems were found from the host mount table
+ # (e.g. /host/proc/1/mounts was unreadable), try the /storage mount directly.
+ # The disk-collector container always has /storage bind-mounted from the host,
+ # so df on /storage reflects the actual backing device and its capacity.
+ if [[ "$FIRST" -eq 1 ]] && mountpoint -q /storage 2>/dev/null; then
+ STATS=$(df -B1 /storage 2>/dev/null | awk 'NR==2{print $1,$2,$3,$4,$5}')
+ if [[ -n "$STATS" ]]; then
+ read -r dev size used avail pct <<< "$STATS"
+ pct="${pct/\%/}"
+ FS_JSON+="{\"fs\":\"${dev}\",\"size\":${size},\"used\":${used},\"available\":${avail},\"use\":${pct},\"mount\":\"/storage\"}"
+ FIRST=0
+ log "Used /storage mount as fallback for filesystem info."
+ fi
+ fi
+
FS_JSON+="]"
# Use a tmp file for atomic update