feat(server): show the Unraid array's free space and check the archive volume before filing uploads

On Unraid the archive is a user share (FUSE shfs), which reports the share's
primary storage, often the cache, while the mover sends the photos to the
array: the admin panel showed the cache's free space (owner review 2, R2).

- New option SpacePath (server.json) / CHRONOS_SPACE_PATH: the admin panel
  shows that folder's volume; empty, or a folder that cannot be measured, falls
  back to the archive's volume (one warning, at start, not per request).
- VolumeSpace measures folders (DriveInfo; the path root on Windows) and reads
  the filesystem type and mount from /proc/self/mountinfo on Linux (longest
  mount point on segment boundaries, octal escapes, optional fields, the top of
  stacked mounts), since DriveFormat calls an shfs share only "fuse". It is an
  injectable service, so tests simulate a full volume; the /data checks use it.
- ArchiveStatsDto keeps FreeBytes/CapacityBytes for the shown volume and gains
  optional trailing members: the write volume's figures (when a space path is
  in use and they differ), the filesystem type and UsesSpacePath.
- Admin panel (dashboard and archive): a tooltip on the storage figures names
  the volume and its filesystem and, on an shfs share without a space path,
  says they are the primary storage and to map the array view to /space; a
  "Write volume" line shows the archive's own volume when it differs.
- Completing an upload, a render upload or a render node's result checks the
  archive volume for its size plus the 64 MiB reserve before the staging copy
  and answers 507 insufficient_storage, the upload still receiving.
- Diagnostics list the archive and space volumes with filesystem and mount.
- Unraid template: optional read-only "Array view" /space (default
  /mnt/user0/Timelapse) and "Space path" CHRONOS_SPACE_PATH=/space; compose and
  the releases README describe the same as an option.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-10-26 21:58:27 +01:00
1 parent 5209579631
commit d560b41b81
22 files changed
+641 -66

No files matched your search

+14 -1
View File
@@ -111,6 +111,15 @@ public sealed record RenderDto(
string? ProducedBy);
/// <summary>Aggregates for the archive dashboard and the admin panel.</summary>
/// <param name="FreeBytes">Free bytes of the space volume: the server's space path when one is set, else the archive's volume.</param>
/// <param name="CapacityBytes">Size of the space volume.</param>
/// <param name="WriteFreeBytes">
/// Free bytes of the archive's own volume, where uploads are written, when a space path is in use and its figures
/// differ (an Unraid share's primary storage, often the cache); null otherwise and from servers before owner review 2.
/// </param>
/// <param name="WriteCapacityBytes">Size of that write volume, with <paramref name="WriteFreeBytes"/>.</param>
/// <param name="FileSystem">Filesystem type of the space volume (<c>ext4</c>, <c>NTFS</c>, <c>fuse.shfs</c> for an Unraid share); null when unknown.</param>
/// <param name="UsesSpacePath">The space volume is the server's space path, not the archive's volume.</param>
public sealed record ArchiveStatsDto(
long Sequences,
long Photos,
@@ -125,7 +134,11 @@ public sealed record ArchiveStatsDto(
IReadOnlyList<KeyValueCount> ByCamera,
IReadOnlyList<KeyValueCount> ByFormat,
int SequencesWithoutProxies,
int UnverifiedSequences);
int UnverifiedSequences,
long? WriteFreeBytes = null,
long? WriteCapacityBytes = null,
string? FileSystem = null,
bool UsesSpacePath = false);
public sealed record KeyValueCount(string Key, long Count, long Bytes);