Connecting a NAS to Linux via iSCSI
If your vCloud server and NAS storage are on separate machines, the most reliable way to connect them is iSCSI.
iSCSI allows the NAS to present a disk over the network, and Linux sees it as a local block device (like /dev/sdb). This is ideal for video storage because it usually performs better than SMB/NFS for large sequential writes.
Architecture
+-------------------+ iSCSI +-------------------+
| vCloud Server | <-----------------> | NAS |
| Ubuntu Server | | Synology/TrueNAS |
| 192.168.1.10 | | 192.168.1.20 |
+-------------------+ +-------------------+
Step 1 — Prepare the NAS
You need to configure the NAS and create an iSCSI LUN. To do this, refer to the user manual for your NAS server.
Step 2 — Install iSCSI Client on Ubuntu
On the vCloud server:
sudo apt update
sudo apt install open-iscsi -y
Enable the service:
sudo systemctl enable --now iscsid
Step 3 — Discover the NAS Target
Replace 192.168.1.20 with your NAS IP.
sudo iscsiadm -m discovery -t sendtargets -p 192.168.1.20
You should see something like:
192.168.1.20:3260,1 iqn.2026-07.local.synology:vcloud-storage
Step 4 — Configure Authentication (if CHAP is enabled)
Edit the node configuration:
sudo nano /etc/iscsi/iscsid.conf
Find and set:
node.session.auth.authmethod = CHAP
node.session.auth.username = vcloud
node.session.auth.password = StrongPassword123
Save the file.
Restart the service:
sudo systemctl restart iscsid
Step 5 — Log In to the iSCSI Target
sudo iscsiadm -m node --login
Expected output:
Login to [iface: default, target: iqn.2026-07.local.synology:vcloud-storage, portal: 192.168.1.20,3260] successful.
Step 6 — Verify the New Disk
List disks:
lsblk
Example:
sda 1.8T
├─sda1
└─sda2
sdb 10.0T
The iSCSI disk is usually sdb.
Step 7 — Create a Filesystem
⚠️ This will erase the iSCSI disk.
sudo mkfs.ext4 /dev/sdb
Step 8 — Create a Mount Point
sudo mkdir -p /mnt/vcloud-storage
Step 9 — Mount the Disk
sudo mount /dev/sdb /mnt/vcloud-storage
Check:
df -h
Example:
/dev/sdb 9.8T 24K 9.3T 1% /mnt/vcloud-storage
Step 10 — Make the Mount Persistent
Get the UUID:
sudo blkid /dev/sdb
Example:
/dev/sdb: UUID="a1b2c3d4-e5f6-7890-abcd-1234567890ef"
Edit /etc/fstab:
sudo nano /etc/fstab
Add:
UUID=a1b2c3d4-e5f6-7890-abcd-1234567890ef /mnt/vcloud-storage ext4 _netdev,nofail 0 2
Test:
sudo umount /mnt/vcloud-storage
sudo mount -a
If there are no errors, the configuration is correct.
Step 11 — Ensure iSCSI Reconnects After Reboot
Enable automatic login:
sudo iscsiadm -m node --op update -n node.startup -v automatic
Check:
sudo iscsiadm -m node
Useful Commands
Check iSCSI sessions
sudo iscsiadm -m session
Log out
sudo iscsiadm -m node --logout
Rediscover targets
sudo iscsiadm -m discovery -t sendtargets -p 192.168.1.20