Skip to content

Storage usage is inaccurate with SMB/CIFS mount backed by TrueNAS ZFS child datasets #28130

@Jttoal

Description

@Jttoal

I have searched the existing issues, both open and closed, to make sure this is not a duplicate report.

  • Yes

The bug

Immich's storage usage display is inaccurate when UPLOAD_LOCATION is a SMB/CIFS mount from TrueNAS SCALE, where the SMB share points to a parent ZFS dataset that contains child datasets.

In this setup, the files are accessible correctly through the SMB mount, but the storage usage shown by Immich only reflects the parent dataset's own statfs/df usage, not the data stored in child datasets.

This makes the storage widget misleading. Immich shows only a few hundred MiB used, while the actual photo library is over 600 GiB.

Related to #4318, but this is a Linux Docker + TrueNAS SMB/CIFS + ZFS child dataset case.

Environment

  • Immich Server: v2.7.5
  • Server OS: Ubuntu 24.04 LTS
  • Docker deployment
  • Storage backend: TrueNAS SCALE 24.10.0.2
  • Mount protocol: SMB/CIFS
  • TrueNAS dataset layout:
/mnt/mp1/home              parent dataset, shared via SMB
/mnt/mp1/home/user1       child dataset
/mnt/mp1/home/user2        child dataset

The Docker host mounts the SMB share as:

/mnt/data
Immich mounts it into the container as:

/mnt/data -> /usr/src/app/upload
/mnt/data -> /usr/src/app/upload/library
/mnt/data/immich/upload -> /usr/src/app/upload/upload
/mnt/data/immich/backup -> /usr/src/app/upload/backups

Observed behavior
Inside the Immich container, df reports only the parent dataset's written data:

Filesystem          Type  Size  Used  Avail  Use%  Mounted on
//192.168.0.11/home cifs  3.0T  238M  3.0T   1%    /usr/src/app/upload

Immich displays approximately:

Used: ~120-238 MiB / 2.9 TiB

But the actual storage usage on TrueNAS is about:

Parent dataset data written: ~237 MiB
Children datasets: ~612 GiB
Total allocation: ~612 GiB
The files are accessible and usable through SMB, but the capacity display is wrong because the SMB/CIFS statfs result does not include child dataset usage.

Expected behavior

Immich should provide a way to display a more meaningful storage usage value for network storage setups.

Possible improvements:

Add an option to calculate "library size" from Immich-managed asset files instead of relying only on filesystem statfs.
Show two values separately:
filesystem capacity from statfs
Immich library size from database/file records
Allow admins to configure multiple storage roots and aggregate usage across them.
Allow overriding or disabling the storage capacity widget when the underlying filesystem reports misleading values.

Why this matters

For TrueNAS users, a common setup is:

  • each user has a child dataset, so they can access their own Photos_lib directly from PCs via SMB
  • Immich also reads the same Photos_lib paths
  • the SMB parent share works correctly for file access
  • switching to NFS would require one NFS share and one mount per child dataset, which adds operational overhead whenever a new user is added
  • So SMB is the better protocol for file access in this layout, but Immich's storage usage display becomes inaccurate.

The OS that Immich Server is running on

Ubuntu 24.04 LTS

Version of Immich Server

v2.7.5

Version of Immich Mobile App

v2.7.5

Platform with the issue

  • Server
  • Web
  • Mobile

Device make and model

No response

Your docker-compose.yml content

#
# WARNING: Make sure to use the docker-compose.yml of the current release:
#
# https://github.com/immich-app/immich/releases/latest/download/docker-compose.yml
#
# The compose file on main may not be compatible with the latest release.
#

name: immich


    
services:
  immich-server:
    container_name: immich_server
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    extends:
      file: hwaccel.transcoding.yml
      service: vaapi # set to one of [nvenc, quicksync, rkmpp, vaapi, vaapi-wsl] for accelerated transcoding
    devices:
      - /dev/dri:/dev/dri
    volumes:
      # Do not edit the next line. If you want to change the media storage location on your system, edit the value of UPLOAD_LOCATION in the .env file
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - ${LIBRARY_LOCATION}:/usr/src/app/upload/library
      - ${UPLOAD_QUEUE_LOCATION}:/usr/src/app/upload/upload
      - ${THUMB_LOCATION}:/usr/src/app/upload/thumbs
      - ${ENCODED_VIDEO_LOCATION}:/usr/src/app/upload/encoded-video
      - ${PROFILE_LOCATION}:/usr/src/app/upload/profile
      - ${BACKUP_LOCATION}:/usr/src/app/upload/backups
      - /etc/localtime:/etc/localtime:ro
      - ${IMPORT_LOCATION}:/import
    env_file:
      - .env
    environment:
      DB_PASSWORD_FILE: /run/secrets/immich_db_password
    secrets:
      - immich_db_password
    ports:
      - '2283:2283'
    depends_on:
      - redis
      - database
    restart: always
    networks:
      - default
    healthcheck:
      disable: false

...

Your .env content

# The location where your uploaded files are stored. Immich storage metrics
# track this filesystem, so keep it on the large mechanical disk.
UPLOAD_LOCATION=/mnt/data
LIBRARY_LOCATION=/mnt/data
UPLOAD_QUEUE_LOCATION=/mnt/data/immich/upload
THUMB_LOCATION=/data/apps/immich/library/thumbs
ENCODED_VIDEO_LOCATION=/data/apps/immich/library/encoded-video
PROFILE_LOCATION=/data/apps/immich/library/profile
BACKUP_LOCATION=/mnt/data/immich/backup
IMPORT_LOCATION=/mnt/data/



# The Immich version to use. You can pin this to a specific version like "v1.71.0"
IMMICH_VERSION=v2.7.5

Reproduction steps

  1. Create a TrueNAS SCALE parent dataset shared via SMB.
  2. Create child datasets under that parent dataset.
  3. Store most photos in the child datasets.
  4. Mount the parent SMB share on the Docker host.
  5. Bind mount it into Immich as UPLOAD_LOCATION / library storage.
  6. Check Immich storage usage display.
  7. Compare it with TrueNAS dataset usage or du.

Relevant log output

Additional information

This is not a file access problem. Immich can access the files. The issue is that the UI appears to treat statfs/df as representative of actual Immich storage usage, which is not reliable for this SMB/CIFS + ZFS child dataset layout.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions