Importing and mounting SCSI disks from a NAS

In my current Work Center we have a SAN which in turn uses a NAS which from time to time I need to access to obtain or deposit some data.

To manage and share NAS resources we use FreeNAS, which allows us to access shared folders through CIFS, NFS, FTP o Tftp. But there is also another way to "mount" any of the partitions created as a local disk on our computer.

For this we have to use the package open-iscsi.

At this point I would like to clarify that it is not my objective to explain what it is iSCSI, SCSI and other terms that may be new to some users. That is why I am leaving links to Wikipedia

And now the fun begins:

1- Install the open-iscsi package

$ sudo aptitude install open-iscsi

2- Stop the service:

$ sudo /etc/init.d/open-iscsi stop

3- Make a save of the file /etc/iscsi/iscsid.conf and then edit it:

$ sudo cp /etc/iscsi/iscsid.conf /etc/iscsi/iscsid.conf.origin $ sudo nano /etc/iscsi/iscsid.conf

4- Put the following in that file:

node.startup = automaticnode.leading_login = No node.session.auth.authmethod = CHAP node.session.auth.username = [chap_user] node.session.auth.password = [chap_password] discovery.sendtargets.auth.authmethod = CHAP discovery .sendtargets.auth.username = [chap_user] discovery.sendtargets.auth.password = [chap_password] node.session.timeo.replacement_timeout = 120 node.conn [0] .timeo.login_timeout = 15 node.conn [0] .timeo .logout_timeout = 15 node.conn [0] .timeo.noop_out_interval = 5 node.conn [0] .timeo.noop_out_timeout = 5 node.session.err_timeo.abort_timeout = 15 node.session.err_timeo.lu_reset_timeout = 30 node.session. err_timeo.tgt_reset_timeout = 30 node.session.initial_login_retry_max = 8 node.session.cmds_max = 128 node.session.queue_depth = 32 node.session.xmit_thread_priority = -20 node.session.iscsi.InitialR2mediaT = No node.sessioniste.is. = Yes node.session.iscsi.FirstBurstLength = 262144 node.session.iscsi.MaxBurstLength = 16776192 node.conn [0] .iscsi.MaxRecvDataSegmentLengt h = 262144 node.conn [0] .iscsi.MaxXmitDataSegmentLength = 0 discovery.sendtargets.iscsi.MaxRecvDataSegmentLength = 32768 node.session.nr_sessions = 1 node.session.iscsi.FastAbort = Yes

5- We save and restart the service or start it:

$ sudo /etc/init.d/open-iscsi restart

6- Now to see the volumes of the SAN we put:

# iscsiadm --mode discovery --type sendtargets --portal [IP del SAN]

In my case it would be:

# iscsiadm --mode discovery --type sendtargets --portal 192.168.24.20

7- What it does is list the SAN volumes and their IQN, and it returns something like this:

iqn.2002-10.com.infortrend:raid.sn7817070.001

8- Then we access with the command:

# iscsiadm --mode node --targetname iqn.2002-10.com.infortrend:raid.sn7817070.001 --portal 192.168.24.20:3260 --login

From that moment, if we execute in the terminal:

# fdisk -l

We will see that we will have available all the partitions or volumes of the SAN, which we can mount as if it were a hard disk or a memory.

When we are done, we disassemble everything we have used and stop the service:

$ sudo /etc/init.d/open-iscsi stop


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   eliotime3000 said

    Very useful if you want to install on servers. Added to favorites.

  2.   dragnell said

    This is a world of the most interesting here at JCCE we have already tried several alternatives openmediavault, nas4free, freenas, glusterfc, even drbd + openmediavault to obtain a hybrid of san but we never had the resources for that and zfs …… .. well less than less ... Salu2s

  3.   JP said

    I have been using Frenas for some time and I use iSCSI in a Windows Server 2008 HA Cluster, to date and even with the steps in this article I still cannot make the connection of these disks with Linux, Windows sees them perfectly and mounts them but with Linux I always get the same error:

    iscsiadm: Login authentication failed with target
    iscsiadm: discovery login to xxxx failed, giving up 5
    iscsiadm: Could not perform SendTargets discovery: encountered non-retryable iSCSI login failure