Linux iSCSI

-- LVM CLI -- ISCSI Add/Remove Disk -- ISCSI Multi Connections -- Migrate to Compellent -- ISCSI ADM --
 
--- Bingnfs2-iSCSI.html --- --- BINGNFS-NOTES.html --- --- MakeChangesToCompellentStorage.html --- --- Retire-A-VMServer.html
 
** ISCSI CLI | ISCSI URLs **
 
These commands configured theater & hudsonv (oracle linux )
  1. apt-get install open-iscsi
      or oracle linux
    yum install iscsi-initiator-utils.x86_64
     
  2. Add the correct IP and network device number entry to /etc/network/interfaces for UBUNTU servers.
    	## iSCSI
    	auto eth.<network device number>
    	iface eth.<network device number> inet static
    	address 10.1.1.<###>
    	netmask 255.255.255.0
    	broadcast 10.1.1.255
  3. vi /etc/iscsi/iscsid.conf
  4. Restart the initiator & the daemon :
    /etc/init.d/open-iscsi restart
      or RHEL 5 & 6
    /etc/init.d/iscsid restart; /etc/init.d/iscsi restart
      or RHEL7
    /usr/bin/systemctl restart iscsid
    /usr/bin/systemctl restart iscsi :: Because the iscsi disk can't be found yet, this will run a long time.
    RHEL6 will require this to start iSCSI:   service iscsid force-start
    ...and it still might not start.
    Run /etc/init.d/iscsid restart; /etc/init.d/iscsi restart
    The supplied /etc/iscsi/iscsi.conf must be used.
    I have a doctored file that includes the oracle parms at:
    http://curubuntu.cc.binghamton.edu/iscsid.config.oracle .
    Replace and try this one it could save time later.
  5. /sbin/iscsiadm -m discovery -d 5 -t st -p 10.1.1.1:3260 # -d 5 is debug/verbose lines
    -- COMPLELLENT --
    /sbin/iscsiadm -m discovery -d 5 -t st -p 10.1.2.14:3260 # -d 5 is debug/verbose lines
    /sbin/iscsiadm -m discovery -d 5 -t st -p 10.1.2.15:3260 # -d 5 is debug/verbose lines
    ( A target name or names will be returned. Note It for STEP 5:   ...   iqn.*........*)
     
    If this fails or has an errant return try this to remove the current discovery records:
    /sbin/iscsiadm -m discovery -t sendtargets -p 10.1.1.1:3260 -o delete
    For complete purge :   cd /var/lib/iscsi/nodes; rm -rf * ... for some recovery add /bin/tar -cvf nodes.tar nodes/* inbetween those two commands.
     
    To refresh an existing system to see the connected LUNs.....
    /sbin/iscsiadm -m session -R
     
    NOTE: To get the login/out to work you must have the network device identified.
    For most of the systems this will do that:   iscsiadm -m iface -I eth1 --op=new
    NOTE: if a volume group is not activate it with this command: vgchange -a y
    A non disruptive method to disconnect or connect a discovered LUN:
    # /sbin/iscsiadm -m node -T iqn name --logout
    Logging out of session [sid: 1, target: iqn name, portal: 10.1.1.1,3260]
    Logout of [sid: 1, target: iqn name, portal: 10.1.1.1,3260] successful.
    # /sbin/iscsiadm -m session -R
    iscsiadm: No session found.
    
    # /sbin/iscsiadm -m node --interface=eth<device number> -T < iqn name > --login
    Logging in to [iface: eth<device number>, target: < iqn name >, portal: 10.1.1.1,3260] (multiple)
    Login to [iface: eth<device number>, target: < iqn name >, portal: 10.1.1.1,3260] successful.
    # /sbin/iscsiadm -m session -R
    Rescanning session [sid: 2, target: i< iqn name >, portal: 10.1.1.1,3260]
     -- login to all
    iscsiadm -m node -l
  6. /sbin/iscsiadm --mode node --targetname     < iqn name >     -p 10.1.1.1:3260
    -- COMPLELLENT --
    /sbin/iscsiadm --mode node --targetname     < iqn name >     -p 10.1.2.14:3260
    /sbin/iscsiadm --mode node --targetname     < iqn name >     -p 10.1.2.15:3260
     
    Regarding the Compellent for example given what the discover returns for each pair.
    /sbin/iscsiadm --mode node --targetname iqn.2002-03.com.compellent:5000d31001266824 -p 10.1.2.15:3260
    /sbin/iscsiadm --mode node --targetname iqn.2002-03.com.compellent:5000d31001266826 -p 10.1.2.15:3260
    /sbin/iscsiadm --mode node --targetname iqn.2002-03.com.compellent:5000d31001266823 -p 10.1.2.14:3260
    /sbin/iscsiadm --mode node --targetname iqn.2002-03.com.compellent:5000d31001266825 -p 10.1.2.14:3260
     
  7. cd /var/lib/iscsi/nodes/<IQN returned in step 4>-<hostname>/<ip>,<port>,1/
    UBUNTU: cd /etc/iscsi/nodes
     
  8. vi default
    This can be useful: find . -name default -print | xargs vi
  9. Restart the initiator: & the daemon  
  10. fdisk -l # you should now see the new disk...create your filesystem.
     
  11. Do so with Logical Volume Manager: lvm
     

ISCSI CLI
 

The LVM GUI is not longer available but the new scheme is actually a bit simpler.

  1. fdisk -l should return the device name that is in /dev generally it will be sdb.
    This example will use that expectation. Also VG will be VolGroup01. Use any VG you wish.
     
  2. Create the Physical Volume: /sbin/pvcreate /dev/sdb
    Check with pvscan or pvdisplay
     
  3. Create the Volume Group: /sbin/vgcreate VolGroup01 /dev/sdb
    Check with vgscan or vgdisplay
     
  4. Create the Logical Volume(s): /usr/local/bin/mk-lvcreate.sh
    usage: /usr/local/bin/mk-lvcreate.sh <volgroupname> <size> <logicalvolumename>
                                                         size in gigabyte no G
            For example:  /usr/local/bin/mk-lvcreate.sh VolGroup01 350 u01
    Check with lvscan or lvdisplay
     
  5. Create the File Systems: /usr/local/bin/mk-mkfs.sh
    usage: /usr/local/bin/mk-mkfs.sh <volgroupname>
           This will create commands to make the filesystems for the LV's defined above ...
           AND if they look good:  /usr/local/bin/mk-mkfs.sh <volgroupname> > /tmp/mkfs.sh ; sh /tmp/mkfs.sh
  6. Create the Mount Points: /usr/local/bin/mk-mp.sh
    usage: /usr/local/bin/mk-mp.sh <volgroupname>
           This will echo the commands to creating mount points.
           AND if they look good:  /usr/local/bin/mk-mp.sh <volgroupname> > /tmp/mkmp.sh ; sh /tmp/mkmp.sh
    Check with ls -ltr /
  7. Create the entries for /etc/fstab: /usr/local/bin/mk-fstab-entry.sh
    usage: /usr/local/bin/mk-fstab-entry.sh <volgroupname>
       AND if they look good. cp -p /etc/fstab /etc/0.fstab; /usr/local/bin/mk-mp.sh <volgroupname> >> /etc/fstab
    Check two ways: cat /etc/fstab
    umount -a ; ls -ltr ; mount -a ; ls -ltr
To change from IP connections to initiatorname connections.
  1. cd /etc/iscsi
  2. vi initiatorname.iscsi
  3. Change the InitiatorName from iqn.1988-12.com.oracle:c4d4f1486d52
    to some string unique to the server like ... iqn.1988-12.com.oracle-<FQDN>
    for example: iqn.1988-12.com.oracle-adirdb.cc.binghamton.edu
  4. Email the new InitatorName and theHostname to Gary.
  5. When he indicates he has changed his settings ... reboot
  6. Confirm the volume and partitions are still what you created.
 
Find the InitiatorName for current session(s) :
/sbin/iscsiadm -d4 -m session 2>&1 |grep initiatorname |grep "attribute value"
 
List the iqn names :
iscsiadm --mode node
 
List the settings for an iqn :
/sbin/iscsiadm --mode node --targetname <iqn name> -- portal 10.1.1.1:3260
 
-
  1. cuddletech.com  
  2. howtoforge/iscsi_on_linu  
  3. linux-iscsi.sourceforge  

Valid html 4.0 Transitional

keywords: linux iscsi ISCSI iSCSI admiscsi discovery