Docs

Run on TrueNAS

Run Drive on a Linux host with your documents on a TrueNAS SMB share.

Drive runs on a Linux Docker host and mounts the TrueNAS share over SMB. On a Mac mini, see Mac mini with TrueNAS.

Prepare TrueNAS

  1. Create the share

    Create the dataset tank/documents (Generic preset), owned by your own TrueNAS user. Add an SMB share named documents with no guest access.

  2. Add snapshots

    Add an hourly and a daily snapshot task on the dataset.

Mount the share on the Drive host

  1. Write the credentials file

    sudo install -m 600 /dev/null /etc/drive-smb.cred
    printf 'username=YOUR_TRUENAS_USER\npassword=THE_PASSWORD\n' | sudo tee /etc/drive-smb.cred >/dev/null
    
  2. Mount at boot

    Add one line to /etc/fstab:

    //truenas.local/documents /mnt/truenas/documents cifs credentials=/etc/drive-smb.cred,vers=3.0,uid=0,gid=0,file_mode=0664,dir_mode=0775,_netdev,nofail,x-systemd.automount,x-systemd.requires=network-online.target 0 0
    
    sudo mkdir -p /mnt/truenas/documents && sudo systemctl daemon-reload && sudo mount /mnt/truenas/documents
    
  3. Start Docker after the mount

    Run sudo systemctl edit docker.service and add [Unit] and RequiresMountsFor=/mnt/truenas/documents.

  4. Check it

    docker run --rm -v /mnt/truenas/documents:/d alpine ls /d | head
    

Start Drive

  1. Set the paths

    In deploy/.env, set DRIVE_DOCUMENTS_LOCATION=/mnt/truenas/documents. Point DRIVE_APP_DATA_LOCATION, DRIVE_DB_DATA_LOCATION, DRIVE_TRANSLATION_DATA_LOCATION and DRIVE_EMBEDDING_DATA_LOCATION at folders on the host’s own disk, for example under /srv/drive/. Never put them on the share.

  2. Start the stack

    Follow Run on a server. Then, in Settings > Library, set the source path to /documents and the share address to smb://truenas.local/documents.

  3. Connect Finder

    On your Mac, choose Finder > Go > Connect to Server, enter smb://truenas.local/documents, and add it to Login Items.

Keep SMB on your LAN and never forward port 445 to the internet. Back up Drive’s database too: see Back up and restore.

If something is wrong

Drive shows an empty folder after a reboot

Run docker compose restart worker api once the share is mounted.