Fix immich disk quota and usage detection
- Update quota from 200GB to 500GB (matches NixOS config) - Fix disk usage path: /var/lib/immich-server -> /var/lib/immich - Add service-to-directory mapping for accurate disk usage detection This should resolve the "<1MB disk usage of 200GB" issue - immich should now correctly show usage of /var/lib/immich with 500GB quota.
This commit is contained in:
parent
1b572c5c1d
commit
b0112dd8ab
@ -261,15 +261,26 @@ impl ServiceCollector {
|
||||
}
|
||||
|
||||
async fn get_service_disk_usage(&self, service: &str) -> Result<f32, CollectorError> {
|
||||
// Only check the most likely path to avoid multiple du calls
|
||||
let primary_path = format!("/var/lib/{}", service);
|
||||
// Map service names to their actual data directories
|
||||
let data_path = match service {
|
||||
"immich-server" => "/var/lib/immich", // Immich server uses /var/lib/immich
|
||||
"gitea" => "/var/lib/gitea",
|
||||
"postgresql" | "postgres" => "/var/lib/postgresql",
|
||||
"mysql" | "mariadb" => "/var/lib/mysql",
|
||||
"unifi" => "/var/lib/unifi",
|
||||
"vaultwarden" => "/var/lib/vaultwarden",
|
||||
service_name => {
|
||||
// Default: /var/lib/{service_name}
|
||||
return self.get_directory_size(&format!("/var/lib/{}", service_name)).await;
|
||||
}
|
||||
};
|
||||
|
||||
// Use a quick check first - if directory doesn't exist, don't run du
|
||||
if tokio::fs::metadata(&primary_path).await.is_err() {
|
||||
if tokio::fs::metadata(data_path).await.is_err() {
|
||||
return Ok(0.0);
|
||||
}
|
||||
|
||||
self.get_directory_size(&primary_path).await
|
||||
self.get_directory_size(data_path).await
|
||||
}
|
||||
|
||||
async fn get_directory_size(&self, path: &str) -> Result<f32, CollectorError> {
|
||||
@ -370,7 +381,7 @@ impl ServiceCollector {
|
||||
"gitea" => Ok(100.0), // NixOS sets 100GB quota for gitea
|
||||
"postgresql" | "postgres" => Ok(50.0), // Reasonable database quota
|
||||
"mysql" | "mariadb" => Ok(50.0), // Reasonable database quota
|
||||
"immich-server" => Ok(200.0), // Large photo storage needs
|
||||
"immich-server" => Ok(500.0), // NixOS sets 500GB quota for immich
|
||||
"unifi" => Ok(10.0), // Network management data
|
||||
"docker" => Ok(100.0), // Container storage
|
||||
_ => Err(CollectorError::ParseError {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user