SLES 15
Sponsored Link

Configure iSCSI Initiator
2019/01/17
 
Configure iSCSI Initiator.
This example is based on the environment below.
+----------------------+          |          +----------------------+
| [   iSCSI Target   ] |10.0.0.30 | 10.0.0.31| [ iSCSI Initiator  ] |
|     dlp.srv.world    +----------+----------+     www.srv.world    |
|                      |                     |                      |
+----------------------+                     +----------------------+

[1] Configure iSCSI Initiator.
www:~ #
zypper -n install open-iscsi
www:~ #
vi /etc/iscsi/initiatorname.iscsi
# change to the same IQN you set on the iSCSI target server

InitiatorName=
iqn.2019-01.world.srv:www.initiator01
www:~ #
vi /etc/iscsi/iscsid.conf
# line 58: uncomment

node.session.auth.authmethod = CHAP
# line 62,63: uncomment and specify the username and password you set on the iSCSI target

node.session.auth.username =
username

node.session.auth.password =
password
www:~ #
systemctl restart iscsi iscsid
# discover target

www:~ #
iscsiadm -m discovery -t sendtargets -p 10.0.0.30

10.0.0.30:3260,1 iqn.2019-01.world.srv:dlp.target01
# confirm status after discovery

www:~ #
iscsiadm -m node -o show

# BEGIN RECORD 2.0-876
node.name = iqn.2019-01.world.srv:dlp.target01
node.tpgt = 1
node.startup = manual
node.leading_login = No
iface.iscsi_ifacename = default
.....
.....
node.conn[0].iscsi.IFMarker = No
node.conn[0].iscsi.OFMarker = No
# END RECORD

# login to the target

www:~ #
iscsiadm -m node --login

Logging in to [iface: default, target: iqn.2019-01.world.srv:dlp.target01, portal: 10.0.0.30,3260]
Login to [iface: default, target: iqn.2019-01.world.srv:dlp.target01, portal: 10.0.0.30,3260] successful.

# confirm the established session

www:~ #
iscsiadm -m session -o show

tcp: [1] 10.0.0.30:3260,1 iqn.2019-01.world.srv:dlp.target01 (non-flash)
# confirm the partitions

www:~ #
cat /proc/partitions

major minor  #blocks  name

 252        0   31457280 sda
 252        1   31455232 sda1
 253        0   30441472 dm-0
 253        1     999424 dm-1
   8        0   10485760 sdb
# added new device provided from the target server as [sdb]
[2] After setting iSCSI devide, configure on Initiator to use it like follwos.
# create label

www:~ #
parted --script /dev/sdb "mklabel msdos"

# create partiton

www:~ #
parted --script /dev/sdb "mkpart primary 0% 100%"

# format with ext4

www:~ #
mkfs.ext4 /dev/sdb1

mke2fs 1.43.8 (1-Jan-2018)
Creating filesystem with 2619392 4k blocks and 655360 inodes
Filesystem UUID: dd9d1cd0-4597-421c-950a-47c1353860be
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Allocating group tables: done
Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done

# mount

www:~ #
mount /dev/sdb1 /mnt

www:~ #
df -hT

Filesystem     Type      Size  Used Avail Use% Mounted on
devtmpfs       devtmpfs  1.8G     0  1.8G   0% /dev
tmpfs          tmpfs     1.9G     0  1.9G   0% /dev/shm
tmpfs          tmpfs     1.9G   17M  1.8G   1% /run
tmpfs          tmpfs     1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/sda2      btrfs      40G  2.4G   38G   6% /
/dev/sda2      btrfs      40G  2.4G   38G   6% /boot/grub2/x86_64-efi
/dev/sda2      btrfs      40G  2.4G   38G   6% /tmp
/dev/sda2      btrfs      40G  2.4G   38G   6% /var
/dev/sda2      btrfs      40G  2.4G   38G   6% /.snapshots
/dev/sda2      xfs        37G   70M   37G   1% /home
/dev/sda2      btrfs      40G  2.4G   38G   6% /opt
/dev/sda2      btrfs      40G  2.4G   38G   6% /boot/grub2/i386-pc
/dev/sda2      btrfs      40G  2.4G   38G   6% /usr/local
/dev/sda2      btrfs      40G  2.4G   38G   6% /srv
/dev/sda2      btrfs      40G  2.4G   38G   6% /root
tmpfs          tmpfs     371M     0  371M   0% /run/user/0
/dev/sdb1      ext4      9.8G   37M  9.3G   1% /mnt
Matched Content
 
Tweet