Clone
2
Storing models on a NAS
Pascal Linxweiler edited this page 2026-10-30 14:07:04 +01:00

Storing models on a NAS

Models can live on a NAS (e.g. TrueNAS) while Kaname runs on another machine. Mount the share on the Docker host and point KANAME_MODELS_DIR at the mount.

1. Mount the share on the Docker host

Add a line to /etc/fstab (adjust host, export and mount point):

truenas.lan:/mnt/tank/models  /mnt/nas/models  nfs4  rw,hard,noatime,_netdev  0  0

Then mount it:

sudo mkdir -p /mnt/nas/models
sudo systemctl daemon-reload
sudo mount -a -v
findmnt /mnt/nas/models   # should show your NAS and type nfs4

2. Point Kaname at it

# .env
KANAME_MODELS_DIR=/mnt/nas/models
docker compose up -d --force-recreate worker
docker compose exec worker ls -la /models   # should list the share's contents

Requirements

  • NFSv4. The hf CLI uses file locks, which aren't reliable with NFSv3 or nolock.
  • Writable for Kaname's user. Kaname runs as uid/gid 1000 unless you set PUID/PGID in .env. Either set those to the share's owner (ls -ln /mnt/nas/models), make 1000 the owner of the dataset, or on TrueNAS set Mapall User/Group on the NFS share to that user.
  • Mounted before Docker starts. _netdev makes the mount wait for the network. If the share isn't mounted when the worker starts, Docker uses the empty local folder and models end up on the host's disk. After mounting later, recreate the worker (docker compose up -d --force-recreate worker).
  • hard mount. If the NAS is unreachable, downloads wait instead of writing broken files.

What not to put on the NAS

Keep KANAME_DATA_DIR (the SQLite database) on the Docker host's local disk. SQLite relies on file locking and shared memory that don't work reliably over NFS or SMB.