Knowledge Base
Expand storage space with the iSCSI target service
iSCSI (Internet Small Computer System Interface) is an IP-based (Internet Protocol) storage network standard for linking data storage installations. By transferring SCSI commands over IP networks, iSCSI is used to simplify location-independent storage and retrieval via LANs (Local Area Networks) and WANs (Wide Area Networks).
iSCSI enables clients such as computers, servers and virtual machines to use storage from your NAS / STORAGE DEVICE as a virtual disk. Clients can partition and format virtual data media just like local data media, and use them as storage for the cloudplan data path.
Definition
iSCSI Target: An iSCSI target storage server
iSCSI initiator: iSCSI initiators connect to the targets and use their storage.
iSCSI LUN: is part of the space that initiators can use by connecting to the target.
Creating an iSCSI target using the example of a QNAP™ NAS
1. Go to Storage & Snapshots> iSCSI Storage.
2. Click New iSCSI Target.
3. Enter a name for the target and an alias, and then click Next.
4. Select Create iSCSI LUN and assign it to this target.
5. Go to Storage & Snapshots> Storage / Snapshot.
6. Select a volume.
7. Choose Create> New File-Based iSCSI LUN.
8. Select a storage pool.
9. Highlight Immediate Assignment and then click Next.
10. Enter the LUN name.
11. Specify the LUN capacity.
12. Assign the LUN to a target and then click Next.
13. Review the overview and then click Finish.
Connection to an iSCSI target using an iSCSI initiator under Windows™
1. Find the Windows iSCSI initiator and run it.
2. Enter the IP address of the NAS under Targets> Target and click on Quick Connect. The iSCSI initiator searches for available iSCSI targets and adds them to the Detected Targets list.
3. Format the connected LUN as a disk with NTFS Files System in Windows using disk management.
4. Enter a name and a drive letter and save your entries.
5. The iSCSI LUN storage space now appears as a drive in Windows.
Connect to an iSCSI target using an Open iSCSI initiator on Linux
1. Install the open-iscsi package.
# sudo apt-get install open-iscsi
2. Edit the iscsid.conf file
# sudo nano /etc/iscsi/iscsid.conf
Change the following entries
node.startup = automatic
Optional: Insert the CHAP information for authentication.
node.session.auth.username=username
node.session.auth.password=pwd
Save and close the file.
3. Restart the open-iSCSI service.
# /etc/init.d/open-iscsi restart
4. Detect all iSCSI targets on the iSCSI initiator.
In this example, the NAS IP address is 192.168.10.1 and the default iSCSI port is 3260.
# iscsiadm -m discovery -t sendtargets -p 192.168.10.1:3260
4. Check the available iSCSI nodes.
# iscsiadm -m node
5. Optional: Löschen Sie Knoten, mit denen Sie sich nicht verbinden möchten.
# iscsiadm -m node –op delete –targetname THE_TARGET_IQN
6. Restart the Open iSCSI service for login on all available nodes.
# /etc/init.d/open-iscsi restart
Linux displays a login message.
Example: Login session [iface: default, target: iqn.2004-04.com:TARGET:iSCSI.UbuntuXenial.B9281B, portal: 192.168.10.1,3260] [OK]
7. Check the device status with dmesg.
# dmesg | grep sd
In this example, the device name is /dev/sdb.
8. Create a partition.
# fdisk /dev/sdb
9. Format the partition.
# mkfs.ext3 /dev/sdb1
10. Create a target folder and mount the file system in this folder.
# mkdir /mnt/iscsi
# mount /dev/sdb1 /mnt/iscsi/
The storage target is now ready for use.
11. Finally, add an entry to /etc/fstab to mount the iSCSI drive during startup:
/dev/sdb1 /srv ext4 defaults,auto,_netdev 0 0
12. Make sure everything works as expected by restarting the server.