TrueNAS iSCSI

SMB

In TrueNAS

  • Datasets: Add dataset
  • Dataset Preset: SMB
  • (Add to Proxmox)
    • DC, Storage, Add, SMB/CIFS
    • ID: e.g. truenas-proxmox
    • Can check all content types
    • Username “USER” / Password: TrueNAS’s “USER” user account

On target system

sudo apt install cifs-utils
 
sudo mkdir /etc/samba/
sudo vim /etc/samba/truenas-sambaguest
###
username=sambaguest
password=***
###
 
sudo chmod 600 /etc/samba/truenas-sambaguest
 
sudo mkdir /mnt/video-nas
sudo vim /etc/fstab
### Add lines (IP address of TrueNAS)
//truenas/video /mnt/video-nas cifs credentials=/etc/samba/truenas-sambaguest,uid=1001,gid=1001,file_mode=0664,dir_mode=0775,x-systemd.automount 0 0
###
 
sudo mount /mnt/video-nas/ # to test

If target system is a Synology NAS

UI > File Station > Tools > Mount remote folder > CIFS

Time Machine over SMB in TrueNAS

In TrueNAS:

  • System > SMB > Edit > Advanced > Enable Apple SMB2/3 Protocol Extensions
  • Shares > SMB > (create or edit desired share) > Purpose = Multi-user time machine In macOS:
  • Connect to the share (Finder > Cmd-K)
  • Go to Settings > Time Machine to add the share

iSCSI

See iSCSI

NFS

Note: SMB is more performant

On NAS

  • Share /mnt/main-pool/video as NFS
  • Set “mapall user” and “mapall group” to “root”
    • Note: probably better to change ownership of dataset to “USER” and mapall to “USER”

Mounting shares from unprivileged LXC

SMB is tricky if LXC is not privileged. However, a workaround is to Bind-Mount the CIFS Share from the Host then map the Container user to the Host user with idmap. LXC container configs are located at /etc/pve/lxc/<container_id>.conf

Example mounting TrueNAS’s “video” share as both SMB and NFS. This maps LXC user 100:101 to Host user 1000:1000.

On Proxmox host:

vim /etc/fstab
### Add (see elsewhere for "/etc/samba/truenas-sambaguest")
//truenas/video /mnt/nas-video-jelly cifs credentials=/etc/samba/truenas-sambaguest,uid=1000,gid=1000 0 0
truenas:/mnt/main-pool/video /mnt/nas-video-jelly-nfs nfs defaults 0 0
###
 
systemctl daemon-reload
ls -al /mnt/nas-video-jelly* # Check content of both folder
touch /mnt/nas-video-jelly/qq && rm /mnt/nas-video-jelly/qq
touch /mnt/nas-video-jelly-nfs/qq && rm /mnt/nas-video-jelly-nfs/qq
 
vim /etc/subuid /etc/subgid
### Set both files' content to
root:1000:1
root:100000:65536
###
 
vim /etc/pve/lxc/CONTAINER_ID.conf
### Add
mp0: /mnt/nas-video-jelly,mp=/mnt/nas-video
mp1: /mnt/nas-video-jelly-nfs,mp=/mnt/nas-video-nfs
lxc.idmap: u 0 100000 100
lxc.idmap: g 0 100000 101
lxc.idmap: u 100 1000 1
lxc.idmap: g 101 1000 1
lxc.idmap: u 101 101001 64535
lxc.idmap: g 102 101002 64534
###
 
pct reboot CONTAINER_ID

Now the mount should be available and writable from within the LXC.