It is currently Wed Sep 18, 2019 1:08 pm
All times are UTC + 8 hours

[HOW-TO] use Asustor NAS as ISCSI initiator (client) FOR CONFIRMED USER

Share your awesome tips and tricks here.

[HOW-TO] use Asustor NAS as ISCSI initiator (client) FOR CONFIRMED USER

Postby father.mande » Tue Jan 29, 2019 1:29 am

Hi,
===== THIS is for confirmed users ... (even a good study case for newbies) =====

Following some problem with my NAS, I have decide to extend the storage capabilities using ISCSI storage BUT with Asustor NAS as CLIENT of TARGET ISCSI
... nothing (but perhaps I don't see it) seem to be provide in Web U.I. to create a virtual device with a target ISCSI
... This how-to is to explain (shortly) HOW you can use the tools provide by Asustor to obtain the result

Require :
... have a target ISCSI configured somewhere (Windows, Linux other NAS, etc.)
... ... In my case I use another NAS with a Thin provisioning target of 100 GB. (it's another NAS brand ... but an Asustor NAS as server works same ... )
... NO extra software (I just show you the basic command ... but extra for ex. with managing Chap identification can also be used)
... ... build shell and add it as autorun mechanism can be easily adapted

How-to :
1 discover the target available in a specific I.P. (the other NAS server in my case)
... Target used in this case ... don't use Chap (it's in my local LAN) ... and are define in a server with a know I.P.
/usr/builtin/sbin/iscsiadm -m discovery -t st -p 192.168.10.78
... response is like this (in my case the target I.P. have multiple network interface)
Code: Select all
# /usr/builtin/sbin/iscsiadm -m discovery -t st -p 192.168.10.78
192.168.10.78:3260,1 iqn.2004-04.com.qnap:ts-653:iscsi.ts653.dfcdf8
10.0.5.1:3260,1 iqn.2004-04.com.qnap:ts-653:iscsi.ts653.dfcdf8
10.0.3.1:3260,1 iqn.2004-04.com.qnap:ts-653:iscsi.ts653.dfcdf8
10.8.101.1:3260,1 iqn.2004-04.com.qnap:ts-653:iscsi.ts653.dfcdf8

... I will used the LAN I.P. ... and only ONE ISCSI target is available

2 Connect and login to the specified target
iscsiadm -m node -T iqn.2004-04.com.qnap:ts-653:iscsi.ts653.dfcdf8 -p 192.168.10.78:3260 --login
... the result is visible in syslog (dmesg)
Code: Select all
[161247.232699] scsi host7: iSCSI Initiator over TCP/IP
[161247.262623] scsi 7:0:0:0: Direct-Access     QNAP     iSCSI Storage    4.0  PQ: 0 ANSI: 5
[161247.265951] sd 7:0:0:0: Attached scsi generic sg2 type 0
[161247.266506] sd 7:0:0:0: [sdc] 209715200 512-byte logical blocks: (107 GB/100 GiB)
[161247.270956] sd 7:0:0:0: [sdc] Write Protect is off
[161247.270965] sd 7:0:0:0: [sdc] Mode Sense: 43 00 00 08
[161247.271613] sd 7:0:0:0: [sdc] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
.... OPTIONAL IF PARTITIONED : [161389.272013]  sdc: sdc1
[161247.295704] sd 7:0:0:0: [sdc] Attached SCSI disk

... you can have another information on Partition available if the ISCSI disk is already partitioned and contains file system

3 OPTIONAL create partition and File System
... use fdisk (m,p,1,enter,w) or parted for partitioning (consult the manual)
... use mkfs.ext4 (for ex.) for creating the file system (or ext2, ext3, btrfs, ntfs, vfat, etc.)

4 mount file system on a folder in /volume1
... mkdir /volume1/iscsi (case if new and not exist) ... use ANY name for the folder
... mount /dev/sdc1 /volume1/iscsi (adapt /dev/sdXX ... to your case)

NOW it's possible to use the ISCSI target in the other NAS ... BUT through command line (terminal) ... the new disk IS NOT VISIBLE by Asustor tools

5 add visibility .. from Asustor application (like File Manager)
... USE Web U.I. to create a shared resource on /volume1/iscsi (the mount point)
... ... restrict access if needed ...

NOW you can umount / remount etc. /volume1/iscsi ... without losing the access if you remount it

IMPORTANT REMARKS :
A) ... at boot the node are lost (/etc/iscsi folder) ... so if you manage to use bash script ... restart with discovery
B) ... in case you logout iscsi target (umount then logout) AND want to login again ... IF YOU don't also delete the node ... a NEW device (the following) /dev/sdX is used
... ... so if you have not delete the node ... you MUST manage this change
... ... if you have deleted the node ... redo the discovery and the login ... and THE same device is used (if you don't add another disk during this time)
... ... ... to know the new device (if needed) use dmesg or iscsiadm tools
... ... ... ex. : iscsiadm --mode session -P 3 | grep "Attached scsi disk" | tr -s "\t" " " | cut -f 5 -d " " ... to get the device sdc or what-else ...
C) ... internally (using terminal (ssh) NEVER use /share/iscsi (if you use this name) ... use the real PATH /volume1/iscsi
... ... due to the mount and folder management done by Asustor ... the /share/iscsi is visible in tools and shared resources BUT the folder in a terminal is not visible

Philippe.
AS5002T / AS202TE / AS1002T
My Blog specific to my APKG : https://blog.father-mande.ovh/
User avatar
father.mande
 
Posts: 775
Joined: Sat Sep 12, 2015 2:55 am

Return to Tips & Tricks

  • You cannot post new topics in this forum
    You cannot reply to topics in this forum
    You cannot edit your posts in this forum
    You cannot delete your posts in this forum
    You cannot post attachments in this forum
  • Who is online

    Users browsing this forum: No registered users and 1 guest

cron