Skip to main content

IT - iSCSI target (Fedora Linux 36 / 37 / 38 / 39)

iSCSI

Terminology

Server (target) side

  • Install iSCSI software
    $ sudo  dnf -y install targetcli
  • Create IQN with iscsi-iname (see the example above)
  • Create backstore data areas
    • Quite simple example for most of systems:
      • $ sudo targetcli /backstores/block create disk0 /dev/sdb
      • $ sudo targetcli /backstores/block create disk1 /dev/sdc
      • $ sudo targetcli /backstores/block create disk2 /dev/sdd
    • Note: For entire physical disks I recommend using the WWN instead of disk device or partition id. This ensures that the disk reference will not change during system restarts (quite common when using USB disks). Another option is to use the disk UUID. However, a new partition map is created (using fdisk), the UUID will change. Also, if you are using more tan one iSCSI target, the block name (disk0, disk1 etc) is used as the disk type on the client side. I recommend to use a more clear disk name to help identify disks. On my case, I decide to use the format tid-case-diskn. For example: t14-A-disk0. The case is in upper case to help avoid mixing case ids (A, B etc).
      • $ sudo targetcli /backstores/block create t14-A-disk0 /dev/sdb
      • $ sudo targetcli /backstores/block create t14-A-disk2 /dev/sdc
      • $ sudo targetcli /backstores/block create t14-A-disk4 /dev/sdd
  • Create LUNs

    /> /iscsi/iqn.2003-01.org.linux-iscsi.fedora.x8664:sn.34fb1fb1c6aa/tpg1/luns create /backstores/block/disk7
    Created LUN 7.
    Created LUN 7->7 mapping in node ACL iqn.1994-05.com.redhat:ecdd17858d7
    Created LUN 7->7 mapping in node ACL iqn.2022-05.world.srv:node01.initiator01
    /> /iscsi/iqn.2003-01.org.linux-iscsi.fedora.x8664:sn.34fb1fb1c6aa/tpg1/luns create /backstores/block/disk8
    Created LUN 8.
    Created LUN 8->8 mapping in node ACL iqn.1994-05.com.redhat:ecdd17858d7
    Created LUN 8->8 mapping in node ACL iqn.2022-05.world.srv:node01.initiator01
    /> /iscsi/iqn.2003-01.org.linux-iscsi.fedora.x8664:sn.34fb1fb1c6aa/tpg1/luns create /backstores/block/disk9
    Created LUN 9.
    Created LUN 9->9 mapping in node ACL iqn.1994-05.com.redhat:ecdd17858d7
    Created LUN 9->9 mapping in node ACL iqn.2022-05.world.srv:node01.initiator01
no ACL


Client (initiator) side

    1. Install iSCSI software with dnf
      $ sudo dnf -y install targetcli
    2. Record the iSCSI initiator name on the system where data is to be restored. The iSCSI initiator name is in the /etc/iscsi/initiatorname.iscsi file. If the InitiatorName= value is empty, create an initiator name with the command /sbin/iscsi-iname.  For example:

      $ sudo /sbin/iscsi-iname
      iqn.1994-05.com.redhat:514c64da1856
    3. Add the initiator name to the /etc/iscsi/initiatorname.iscsi file.
      1. Edit the /etc/iscsi/initiatorname.iscsi file with vi command. For example:

        $ sudo vi /etc/iscsi/initiatorname.iscsi
      2. Update the InitiatorName= parameter with the initiator name. For example:

        InitiatorName=iqn.1994-05.com.redhat:514c64da1856

Troubleshooting

iscsiadm: No portals found

  • Client side

    $ sudo iscsiadm --mode discovery --type sendtargets --portal 192.168.0.251
    [sudo] password for afberendsen:
    iscsiadm: No portals found
  • Server side


  • Very likely another process is listening on 3260. Check with lsof -i :3260. For me, the output is

    $ sudo lsof -i :3260
    COMMAND  PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
    tgtd    1456 root    6u  IPv4  25757      0t0  TCP *:iscsi-target (LISTEN)
    tgtd    1456 root    7u  IPv6  25758      0t0  TCP *:iscsi-target (LISTEN)
  • $ sudo systemctl disable iscsid.socket
    $ sudo systemctl disable tgtd.service
  • reboot server and confirm tgtd is not running
  • Back to targetcli and add the default portal



  • Check the client again
    $ sudo iscsiadm --mode discovery --type sendtargets --portal 192.168.0.251
    [sudo] password for afberendsen:
    192.168.0.251:3260,1 iqn.2003-01.org.linux-iscsi.fedora.x8664:sn.34fb1fb1c6aa
    $ cat /proc/scsi/scsi
    Attached devices:
    ....
    Host: scsi26 Channel: 00 Id: 00 Lun: 00
      Vendor: LIO-ORG  Model: disk0            Rev: 4.0
      Type:   Direct-Access                    ANSI  SCSI revision: 06
    Host: scsi26 Channel: 00 Id: 00 Lun: 01
      Vendor: LIO-ORG  Model: disk1            Rev: 4.0
      Type:   Direct-Access                    ANSI  SCSI revision: 06
    Host: scsi26 Channel: 00 Id: 00 Lun: 02
      Vendor: LIO-ORG  Model: disk2            Rev: 4.0
      Type:   Direct-Access                    ANSI  SCSI revision: 06
    Host: scsi26 Channel: 00 Id: 00 Lun: 03
      Vendor: LIO-ORG  Model: disk3            Rev: 4.0
      Type:   Direct-Access                    ANSI  SCSI revision: 06
    Host: scsi26 Channel: 00 Id: 00 Lun: 04
      Vendor: LIO-ORG  Model: disk4            Rev: 4.0
      Type:   Direct-Access                    ANSI  SCSI revision: 06
    Host: scsi26 Channel: 00 Id: 00 Lun: 05
      Vendor: LIO-ORG  Model: disk5            Rev: 4.0
      Type:   Direct-Access                    ANSI  SCSI revision: 06
    Host: scsi26 Channel: 00 Id: 00 Lun: 06
      Vendor: LIO-ORG  Model: disk6            Rev: 4.0
      Type:   Direct-Access                    ANSI  SCSI revision: 06

Sources

  • https://www.ibm.com/docs/en/tsmfve/7.1.1?topic=vmware-manually-configuring-iscsi-device-linux-system
  • https://www.thegeekdiary.com/how-to-configure-iscsi-target-and-initiator-using-targetcli-in-centos-rhel-7/
  • https://www.thegeekdiary.com/how-to-troubleshoot-iscsi-issue-is-centos-rhel-67/

Comments

Popular posts from this blog

Movie - The Wizard of Oz (1939)

  My views Plot In rural  Kansas ,  Dorothy Gale  lives on a farm owned by her Uncle Henry and Aunt Em, and wishes she could be somewhere else. Dorothy's neighbor, Almira Gulch, who had been bitten by Dorothy's dog, Toto, obtains a sheriff's order authorizing her to seize Toto. Toto escapes and returns to Dorothy, who runs away to protect him. Professor Marvel, a charlatan fortune-teller, convinces Dorothy that Em is heartbroken, which prompts Dorothy to return home. She returns just as a  tornado  approaches the farm. Unable to get into the locked storm cellar, Dorothy takes cover in the farmhouse and is knocked unconscious. She seemingly awakens to find the house moving through the air, with her and Toto still inside it. The house comes down in an unknown land, and Dorothy is greeted by a good witch named  Glinda , who floats down in a bubble and explains that Dorothy has landed in Munchkinland in the  Land of Oz , and that the Munchkins are cel...

Movie - Se7en (1995)

  My views Plot In an unnamed city overcome with violent crime and corruption, disillusioned police Detective Lieutenant William Somerset is one week from retirement. He is partnered with David Mills, a young, short-tempered, idealistic detective who recently relocated to the city with his wife, Tracy. On Monday, Somerset and Mills investigate an obese man who was forced to eat until his stomach burst, killing him. The detectives find the word " gluttony " written on a wall. Somerset, considering the case too extreme for his last investigation, asks to be reassigned, but his request is denied. The following day, another victim, who had been forced to cut one pound (0.45 kg) of flesh from his body, is found; the crime scene is marked " greed ." Clues at the scene lead Somerset and Mills to the  sloth  victim, a drug-dealing  pederast  whom they find emaciated and restrained to a bed. Photographs reveal the victim was restrained for precisely one year. Somers...

IT - Which Is Faster: find | cpio -pdvm OR rsync?

To determine which is faster between find | cpio -pdvm and rsync for copying a large directory tree locally, we need to consider several factors: the nature of the operation, the tools' design, the system environment, and the specific use case. Let’s break this down based on the information provided in the web results and general knowledge about these tools. Overview of the Tools find | cpio -pdvm : find : Recursively lists all files and directories in a given path. cpio : A tool for copying files into or out of a cpio or tar archive. In this case, with the -pdvm options: -p : Pass-through mode (copy files from one directory tree to another). -d : Create directories as needed. -v : Verbose mod...