Advertisement
easternnl

CentOS 7 iSCSI Howto

Jun 2nd, 2015
673
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.71 KB | None | 0 0
  1. #Create iSCSI in Firewall
  2. firewall-cmd --permanent --new-service=iscsi-target
  3.  
  4. #Edit /etc/firewalld/services/iscsi-target.xml to allow 3260/tcp
  5.  
  6. #Reload the complete firewall to enable the created service
  7. firewall-cmd --complete-reload
  8.  
  9. #Add the rule to the firewall zone
  10. sudo firewall-cmd --permanent --zone=public --add-service=iscsi-target
  11.  
  12. #And reload the firewall
  13. sudo firewall-cmd --reload
  14.  
  15. #Check if firewall is updated
  16. sudo iptables -nvL | grep 3260
  17.  
  18. # Create iSCSI Block Device of 200GB
  19. zfs create -V 200g zfs/erik-desktop-iscsiblockdevice01.iscsi /dev/zvol/zfs/erik-desktop-iscsiblockdevice01.iscsi
  20.  
  21. #Store the iSCSI files in a certain place
  22. zfs create zfs/iscsifs
  23.  
  24. #Install the iSCSI commandline for admining the iSCSI sub system. Modules are built-in the kernel already
  25. yum install targetcli
  26.  
  27. #Enter the iSCSI sub system
  28. targetcli
  29.  
  30. #Create the storage with fileio
  31. cd /backstores/fileio/
  32. create name=erik-desktop-iscsi01 file_or_dev=/zfs/iscsifs/erik-desktop-iscsi01.iscsi size=10G
  33.  
  34. #Create the storage with block device
  35. cd /backstores/block
  36. create name=erik-desktop-iscsiblockdevice01.iscsi dev=/dev/zvol/zfs/erik-desktop-iscsiblockdevice01.iscsi
  37.  
  38. #Move to the iSCSI
  39. cd /iscsi
  40.  
  41. #Create target
  42. create iqn.2015-02.nl.eastnet.zastron:sn.iscsifs
  43.  
  44. #Create LUN
  45. cd iqn.2015-02.nl.eastnet.zastron:sn.iscsifs
  46. cd tpg1/luns
  47. create /backstores/fileio/erik-desktop-iscsi01
  48.  
  49. #Setup access permissions
  50. cd ../acls
  51. # does not work:
  52. create iqn.2015-02.nl.eastnet:erik-desktop
  53. # this will work
  54. create iqn.1991-05.com.microsoft:erik-desktop
  55.  
  56. #Create portal
  57. cd ../portals
  58. create
  59. Using default IP port 3260
  60. Binding to INADDR_ANY (0.0.0.0)
  61. Created network portal 0.0.0.0:3260.
  62.  
  63. #Logging
  64. /var/log/messages
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement