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
Example: Synology DSM
1. Install iSCSI Manager
-
Open Package Center
-
Install SAN Manager (or iSCSI Manager depending on DSM version)
2. Create a Storage Pool and Volume
If not already created:
-
Storage Manager → Create Pool
-
Create Volume
3. Create an iSCSI LUN
-
SAN Manager → LUN
-
Click Create
-
Choose:
-
Thick Provisioning (recommended)
-
Size: for example
10 TB
-
-
Finish creation
4. Create an iSCSI Target
-
SAN Manager → iSCSI Target
-
Create target
-
Name:
vcloud-storage -
Enable CHAP authentication (recommended)
Example:
-
Username:
vcloud -
Password:
StrongPassword123
5. Map the LUN to the Target
During creation or afterward:
-
Select the LUN
-
Map it to
vcloud-storage
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
For very large storage (8–20 TB+), XFS is also a good choice:
sudo mkfs.xfs /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
If using XFS:
UUID=a1b2c3d4-e5f6-7890-abcd-1234567890ef /mnt/vcloud-storage xfs _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
Step 12 — Give vCloud Access
Assume vCloud runs as user vcloudai.
sudo chown -R vcloudai:vcloudai /mnt/vcloud-storage
Or, if running in Docker:
sudo chmod -R 775 /mnt/vcloud-storage
Step 13 — Use the Storage in Docker Compose
Example:
services:
vms-ai:
image: vcloudaiorg/vcloudai-vms-ai:latest
volumes:
- /mnt/vcloud-storage:/storage
Then restart:
docker compose up -d
Recommended Network Settings
For video surveillance storage:
On both NAS and server
Enable:
-
Jumbo Frames (MTU 9000) if your switch supports it
-
1 Gbps minimum
-
10 Gbps preferred for many cameras
Example:
sudo ip link set dev eth0 mtu 9000
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
Performance Recommendation for vCloud
For a surveillance system:
| Component | Recommendation |
|---|---|
| Filesystem | XFS |
| Network | 10GbE |
| LUN type | Thick Provision |
| Mount options | _netdev,nofail |
| NAS RAID | RAID6 or RAID10 |
| Separate network | Dedicated storage VLAN if possible |
This setup gives you a single large storage volume on the Linux server while keeping the actual disks inside the NAS, and it works very well with vCloud and Docker-based deployments.