diff --git a/core/archipelago/src/disk_monitor.rs b/core/archipelago/src/disk_monitor.rs index dd2bc392..e9868882 100644 --- a/core/archipelago/src/disk_monitor.rs +++ b/core/archipelago/src/disk_monitor.rs @@ -33,11 +33,18 @@ fn parse_df_output(stdout: &str) -> Result<(u64, u64, f64)> { Ok((used, total, percent)) } -/// Check disk usage percentage for the root filesystem. +/// Check disk usage percentage for the data partition. +/// Uses /var/lib/archipelago (encrypted LUKS partition) if available, falls back to /. /// Returns (used_bytes, total_bytes, used_percent). pub async fn check_disk_usage() -> Result<(u64, u64, f64)> { + // Prefer the encrypted data partition — this is where all user data lives + let data_path = if std::path::Path::new("/var/lib/archipelago").exists() { + "/var/lib/archipelago" + } else { + "/" + }; let output = tokio::process::Command::new("df") - .args(["--block-size=1", "--output=used,size", "/"]) + .args(["--block-size=1", "--output=used,size", data_path]) .output() .await .context("Failed to run df")?;