[Plugin] iSCSI Initiator


ich777

Recommended Posts

iSCSI Initiator

This plugin allows you to connect to iSCSI Target(s) and mount the Volume(s) to unRAID.

 

 

Installation of the Plugin:

 

 

  1. Go to the Community Applications App and search for 'iSCSI Initiator' and click on the Download button (you have to be at least on Unraid 6.9.2 to see the plugin in the CA App) :
    grafik.png.8e5d9e460a7b929527f879700840007c.png

    Or download it directly from here:
    https://raw.githubusercontent.com/ich777/iscsi-initiator/master/iscsi-initiator.plg

     
  2. Go to the plugin page to get your Initiator IQN, you can also change it if needed (a random one is created at plugin installation):
    grafik.png.a828caa0f40e249e551a2b6be936a446.png
    (Please note that changing the Initiator IQN is only possible when no Target exists)

     
  3. On your Target set up the Volume(s) that you want to use on unRAID and assign it the Initiator IQN from Step 2.

     
  4. Back on unRAID enter the Target IQN, the IP and the Port from the Target and click "Create & Connect":
    grafik.png.96df2400fb2057d227ead7f6b5bfc8ff.png

     
  5. If everything went correctly you should see at the bottom from the plugin page at the section "Active iSCSI sessions" that the connection is established and working:
    grafik.thumb.png.4ffbef9cd2db4d536df9f5cbdf06690e.png

     
  6. Go back to the "Main" tab from unRAID and you will see that the Volume is now mounted to unRAID.
    grafik.thumb.png.8446f1e33e51d1b5407dcb46201fab1c.png

     
  7. Now you can use the Volume as if it is a device that is physically attached to unRAID.

 

 

If you experience any problems (eg: "Active iSCSI session" showing: grafik.png.437f1d511e3c73e8f63bc96fd8385f95.png) when creating the connection click on this grafik.png.828775d2773424b515915c29ed72e7c0.png button on the top right corner to open up the syslog and create a post with the error from iscsid here, but first please make sure that you've entered the right Target IQN, IP and Port.

 

 

You can delete wrong/non-working/unwanted entries here by simply selecting the target and click "Remove & Disconnect":

grafik.png.97ec1a54ba94da135db4db369aaa4e9b.png

 

 

ATTENTION:

It's not recommend to add Volumes, which are mounted through this plugin, to your Array or Cache Pool(s) because if the Target is not reachable or went offline when unRAID is running really bad things can happen.

  • Like 1
Link to comment
53 minutes ago, Kodey said:

This looks really awesome! I'm excited to use it. Does this plugin also allow to use Unraid as a iscsi target from another device running windows?

This plugin allows you to mount Volumes from targets, the above shown plugin makes unRAID a Target and let other devices mount the Volumes.

 

No, but there is actually another plugin that allows you to do that (simply search for "iSCSI" and you will find both plugins):

grafik.png.fc003610a10f1bdacda84625c6ca565e.png

Link to comment
  • 2 weeks later...
You can do that by editing the file /etc/iscsi/iscsid.conf and add the CHAP details there, but keep in mind you will have to do this on every reboot, will change that so that the file is located on the boot device so the config is persistent.

Sounds good. I’ll hold off on implementing this until that’s been updated. I’m glad to see this is a thing now though, so thank you.
Link to comment
2 minutes ago, eroc1990 said:

Sounds good. I’ll hold off on implementing this until that’s been updated. I’m glad to see this is a thing now though, so thank you.

Deleted my previous comment, found a bug where the iscsid.conf wasn't properly created on the boot device.

I've already implemented that the iscsid.conf is created but that failed -> should be now fixed with version 2021.09.13, please update the plugin.

 

If you now edit the file /boot/config/plugins/iscsi-initiator/iscsid.conf and add your CHAP details there it should work after you reboot your server.

A reboot is necessary because the iscsid daemon has to be restarted after you've changed the file.

 

Hope that's ok for you, here is how to do it:

 

Change this lines from:

#node.session.auth.username = username
#node.session.auth.password = password

 

to:

node.session.auth.username = YOURUSERNAME
node.session.auth.password = YOURPASSWORD

 

 

After that reboot the server.

Link to comment
  • 2 weeks later...

Hi. Thank you for the plugin we are using it to connect to our HPE MSA 1040.
When the server reboots, the iSCSI connection is not re-established, and we have to do the following steps to get it going again:
on the iscsi-initiator page:
1) Remove and Disconnect the existing Defined Target
2) Copy the Initiator Name into the Change Initiator Name text field, and click Change.
3) Populate the Create Connection text field with the target definition info as deleted in step 1, and click Create and Connect
now the Active iSCSI sessions is showing the connection.

on the Main page:

click on the Mount button on the Device.

 

Is there any way to automate this so that we dont have to redo it every time there is a reboot?

Thank you.

 

Link to comment
2 hours ago, Isanderthul said:

Is there any way to automate this so that we dont have to redo it every time there is a reboot?

This is done on reboot and is tested with multiple targets, can you please send me your Diagnostics after a restart where the connection failed?

 

I can only think about a network issue that the network is not fully initialized when the plugin tries to connect to the Target.

Link to comment
5 hours ago, Isanderthul said:

Hi. Thank you for the plugin we are using it to connect to our HPE MSA 1040.

I hope it's okay to post a part from your syslog here:

 

Oct  1 11:59:21 Gen8 unassigned.devices: Disk with serial 'MSA_1040_SAN_00c0ff282747000057d6436101000000', mountpoint 'HP_MSA_1040_SAN' is not set to auto mount.
Oct  1 11:59:22 Gen8 iscsid: Connection1:0 to [target: iqn.1986-03.com.hp:storage.msa1040.1629281c75, portal: 10.99.65.226,3260] through [iface: default] is operational now
Oct  1 12:00:10 Gen8 emhttpd: MSA_1040_SAN_00c0ff282747000057d6436101000000_3600c0ff00028274757d6436101000000 (sdf) 512 64257810432
Oct  1 12:00:10 Gen8 emhttpd: read SMART /dev/sdf

 

From what I see iscsid is mounting the share 1 second to slow... :/

I mainly tested the Initiator on the Array and the Cache without a problem but now that I think about it, the Array and Cache drives are mounted way later than the Unassigned Device drives.

Would it be an option for you to actually create a Cache pool with the iSCSI disk in it?

 

@dlandon can you think of an easy way to delay the mount in UnassignedDevices from the disk?

  • Like 1
Link to comment
2 hours ago, ich777 said:

I hope it's okay to post a part from your syslog here:

 

Oct  1 11:59:21 Gen8 unassigned.devices: Disk with serial 'MSA_1040_SAN_00c0ff282747000057d6436101000000', mountpoint 'HP_MSA_1040_SAN' is not set to auto mount.
Oct  1 11:59:22 Gen8 iscsid: Connection1:0 to [target: iqn.1986-03.com.hp:storage.msa1040.1629281c75, portal: 10.99.65.226,3260] through [iface: default] is operational now
Oct  1 12:00:10 Gen8 emhttpd: MSA_1040_SAN_00c0ff282747000057d6436101000000_3600c0ff00028274757d6436101000000 (sdf) 512 64257810432
Oct  1 12:00:10 Gen8 emhttpd: read SMART /dev/sdf

 

From what I see iscsid is mounting the share 1 second to slow... :/

I mainly tested the Initiator on the Array and the Cache without a problem but now that I think about it, the Array and Cache drives are mounted way later than the Unassigned Device drives.

Would it be an option for you to actually create a Cache pool with the iSCSI disk in it?

 

@dlandon can you think of an easy way to delay the mount in UnassignedDevices from the disk?

In the log snippet above, the iscsi disk is not set to auto mount, so it will have to be mounted manually.  Not sure if that was intended.

 

Mounting of UD disks is done on the array started event - array disks are mounted.  I believe this includes array, cache, and pool disks.  The network might not be available at this time.  As I understand the way this works, the iscsi device has to be mounted across the network before UD can mount it.

 

Remote mounts are delayed for up to 30 seconds before they are mounted and wait for the network to be ready.  I'm reluctant to delay disk mounts until the network is ready because docker containers and VMs may need disk access before the network is available.

 

A little trick would be to enter this command in a User Script set to run at first array start:

sleep 2
/usr/local/sbin/rc.unassigned mount /dev/sdX or devX

Try to use devX and not sdX because sdX can change on a reboot.  devX will always apply to the same device.  Note: 'Dev 1' would be 'dev1', 'Dev 2' would be 'dev2', etc.

 

The sleep time might have to be adjusted depending on the server.

  • Like 1
Link to comment

Hello! I'm experiencing the "no active sessions", but there are no errors:

 

Oct 3 11:43:12 REPOSITORY emhttpd: cmd: /usr/local/emhttp/plugins/community.applications/scripts/pluginInstall.php install https://raw.githubusercontent.com/ich777/iscsi-initiator/master/iscsi-initiator.plg
Oct 3 11:43:12 REPOSITORY root: plugin: running: anonymous
Oct 3 11:43:12 REPOSITORY root: plugin: creating: /boot/config/plugins/iscsi-initiator/iscsi.initiator-2021.09.17.txz - downloading from URL https://raw.githubusercontent.com/ich777/iscsi-initiator/master/packages/iscsi.initiator-2021.09.17.txz
Oct 3 11:43:13 REPOSITORY root: plugin: checking: /boot/config/plugins/iscsi-initiator/iscsi.initiator-2021.09.17.txz - MD5
Oct 3 11:43:13 REPOSITORY root: plugin: running: /boot/config/plugins/iscsi-initiator/iscsi.initiator-2021.09.17.txz
Oct 3 11:43:13 REPOSITORY root: plugin: creating: /usr/local/emhttp/plugins/iscsi-initiator/README.md - from INLINE content
Oct 3 11:43:13 REPOSITORY root: plugin: running: anonymous
Oct 3 11:43:16 REPOSITORY kernel: Loading iSCSI transport class v2.0-870.
Oct 3 11:43:16 REPOSITORY kernel: iscsi: registered transport (tcp)
Oct 3 11:43:16 REPOSITORY iscsid: iSCSI logger with pid=26746 started!
Oct 3 11:43:17 REPOSITORY iscsid: iSCSI daemon with pid=26747 started!
Oct 3 11:43:57 REPOSITORY flash_backup: adding task: /usr/local/emhttp/plugins/dynamix.my.servers/scripts/UpdateFlashBackup.php update
Oct 3 11:47:57 REPOSITORY flash_backup: adding task: /usr/local/emhttp/plugins/dynamix.my.servers/scripts/UpdateFlashBackup.php update

 

image.thumb.png.b4b2e2ee33f15c7d3acf5154614aee2c.png

 

Anything else I could provide that would help, please let me know.

 

Link to comment
1 minute ago, Keek Uras said:

Anything else I could provide that would help, please let me know.

It seems to me that this is only the output from the plugin installation log after the daemon is started.

 

You've entered 'http://172.16.0.54/' please type in only the IP from the Target and don't use http, please look again at the first post.

  • Thanks 1
Link to comment
3 hours ago, ich777 said:

It seems to me that this is only the output from the plugin installation log after the daemon is started.

 

You've entered 'http://172.16.0.54/' please type in only the IP from the Target and don't use http, please look again at the first post.

Ah, I didn't realize I pasted the entire URL, I thought I only grabbed the IP from the NAS web interface, that is totally my fault. I couldn't disconnect and remove the connection in the plugin, I had to uninstall/reinstall the plugin to get rid of it. Turns out even If select only the IP in the URL in Edge, it puts the http in so, heads up for anyone else using Edge. It's an easy mistake to make.

 

Reinstalling the plugin and making sure the http info is not there, it works like it should. Thank you for your quick reply, as always!

Edited by Keek Uras
spelling
  • Like 1
Link to comment
8 minutes ago, Keek Uras said:

I had to uninstall/reinstall the plugin to get rid of it.

Yep, can imagine that this is a thing because you got '/' (slashes) in there and the plugin can't handle them if you want to remove it, will fix this in an upcoming version from the plugin.

 

It would be also possible to remove the config from the settings file too, but a removal and new installation from the plugin will also do the job.

Link to comment
  • 2 weeks later...
On 10/2/2021 at 9:49 AM, Isanderthul said:

Hi @ich777 @dlandon, thank you very much for having a look. im happy my logs gave you some insight into the issue.

I will try auto mounting the msa1040, we have it as an unassigned device, because it is not part of the array. I will try out a few suggested changes and let you know.

Thank you very much for your help. Everything is working. There were multiple problems with my server, first I had a library in the boot/extras that was breaking my user scripts. This prevented the script from mounting the unassigned device. Secondly the licence I had was at the limit of 6 devices, and I needed to upgrade my licence.

  • Like 1
Link to comment
  • 5 months later...

I have a new unraid install and I'm having a couple of problems with this plugin.  I have 2 iscsi targets that I'm trying to connect the server to.

 

First, I'm having the issue that one of the users had earlier in the thread where upon reboot, one of the targets says it's connected, but doesn't show up anywhere and I have to delete it and readd it for it to show up. 

Second, my iscsi volumes are not being mounted when I connect to them.  They just show up as unassigned devices.  The instructions seem to indicate that they should be mounted automatically, but that isn't happening. 

 

Please let me know what logs you need to provide any help. 

Link to comment
4 hours ago, wraith1385 said:

Please let me know what logs you need to provide any help. 

Please send me your logs after all this happened.

 

4 hours ago, wraith1385 said:

The instructions seem to indicate that they should be mounted automatically, but that isn't happening. 

Have you turned on Auto Mount in the Unassigned Devices plugin for this devices?

Link to comment
12 hours ago, wraith1385 said:

First, I'm having the issue that one of the users had earlier in the thread where upon reboot, one of the targets says it's connected, but doesn't show up anywhere and I have to delete it and readd it for it to show up. 

I see that the plugin only tries to connect to one target?

Do you have 2 different machines at home that you are trying to connect or the targets on the same machine?

 

I see only one IQN with one Target in the log: iqn.2000-01.com.synology:Pegasus.Target-1.c85bc750ef

 

What does the plugin page tell you which connections are established? One or two?

 

29 minutes ago, wraith1385 said:

So I didn't know about the unassigned devices plugin and that has fixed the problems with one of the targets. 

If you don't use the targets in the Array or Cache you have to mount them through Unassigned Devices, otherwise you can't mount them properly.

Link to comment
9 minutes ago, ich777 said:

I see that the plugin only tries to connect to one target?

Do you have 2 different machines at home that you are trying to connect or the targets on the same machine?

 

I see only one IQN with one Target in the log: iqn.2000-01.com.synology:Pegasus.Target-1.c85bc750ef

 

What does the plugin page tell you which connections are established? One or two?

There are 2 different machines, essentially 2 NAS boxes. 

 

This is what the plugin shows.  There are 2 targets defined, but it seems like whichever one is the second one defined, doesn't get connected to automatically.

Screen Shot 2022-03-17 at 10.08.18 AM.png

Link to comment
57 minutes ago, wraith1385 said:

There are 2 different machines, essentially 2 NAS boxes. 

Can you send me please the output from:

cat /boot/config/plugins/iscsi-initiator/targets.cfg

issued from an Unraid terminal.

 

EDIT: Forget what I've wrote above, seems like I've built a bug into the plugin, will fix this in the next two hours, I'm currently not at home, will keep you updated when it's fixed.

Thank you for the report!

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.