- Navigate to Datasets, select your Dataset
- Click Add Zvol
- Name: e.g.,
iscsi-disk01 - Size: e.g.,
10GiB - Leave other settings default
- Sync: Standard
- Compression: lz4
- ZFS Deduplicateion: off
- Block size: 16KiB
- Name: e.g.,
- Go to System Settings β Services
- Enable and start iSCSI
- Navigate to Shares β Block (iSCSI)
- Click Wizard
- Target: create new target
- Extent: Device type β select the Zvol you created
- Sharing Platform: Modern OS
- Portal: either βCreate newβ or default (you can use
0.0.0.0:3260) - Initiator: leave blank (for any initiator) or specify your Linux hostβs IQN
- After wizard, edit the target if desired:
- Set Authorized Networks (e.g.,
192.168.0.0/24) for access control
- Set Authorized Networks (e.g.,
- Save changes and verify that the target is listed
sudo apt install open-iscsisudo iscsiadm -m discovery -t sendtargets -p <truenas-ip>sudo iscsiadm -m node -T <target-iqn> -p <truenas-ip> --loginβ
After login, a new device will show up, e.g., /dev/sdX
lsblk-
Format the Disk Create an ext4 filesystem on the new disk:
sudo mkfs.ext4 /dev/sdX
Replace
/dev/sdXwith the actual device name from login step. -
Create Mount Point
sudo mkdir -p /mnt/iscsi
-
Mount Manually (for testing)
sudo mount /dev/sdX /mnt/iscsi
Ensure the mount works before adding to persistent configuration.
-
Enable iSCSI Auto-login
sudo iscsiadm -m node -T <target-iqn> -p <truenas-ip> --op update -n node.startup -v automatic
-
Get the UUID of the Device
sudo blkid /dev/sdX
Copy the
UUID="..."string from the output. -
Update
/etc/fstabAppend bellow line:UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx /mnt/iscsi ext4 _netdev,noatime 0 2UUID=...: identifies the disk/mnt/iscsi: your mount pointext4: filesystem type_netdev: ensures mounting waits for networknoatime: disable updating file's access time0 2: backup and fsck order
Run a test:
sudo mount -a
- In TrueNAS: Dataset β select your Zvol β Edit Zvol β increase size
- On Linux:
-
Rescan to detect new size:
echo 1 | sudo tee /sys/class/block/sdb/device/rescan
-
Resize ext4 Filesystem (Since there's no partition, resize the filesystem directly):
sudo resize2fs /dev/sdb
-
- Use
lsblk,df -h, ormountto confirm the disk - Reboot to verify persistence (if fstab is configured)
- Target IQN format:
iqn.YYYY-MM.domain:targetname - Ensure the TrueNAS and client clocks are synchronized
- Avoid overlapping LUNs or targets
- No need for CHAP unless securing over public networks
- No need for
partedorfdiskwhen resizing if there's no partition table. resize2fsworks even if the filesystem is mounted (for ext4).