Fedora 24
Sponsored Link

Configure iSCSI Initiator
2016/06/22
 
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.
[root@www ~]#
dnf -y install iscsi-initiator-utils
[root@www ~]#
vi /etc/iscsi/initiatorname.iscsi
# change to the same IQN you set on the iSCSI target server

InitiatorName=
iqn.2016-06.world.srv:www.srv.world
[root@www ~]#
vi /etc/iscsi/iscsid.conf
# line 57: uncomment

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

node.session.auth.username =
username

node.session.auth.password =
password
# discover target

[root@www ~]#
iscsiadm -m discovery -t sendtargets -p 10.0.0.30

[ 1293.697741] Loading iSCSI transport class v2.0-870.
[ 1293.730558] iscsi: registered transport (tcp)
10.0.0.30:3260,1 iqn.2016-06.world.srv:storage.target01

# confirm status after discovery

[root@www ~]#
iscsiadm -m node -o show

# BEGIN RECORD 6.2.0.873-33
node.name = iqn.2016-06.world.srv:storage.target01
node.tpgt = 1
node.startup = automatic
node.leading_login = No
...
...
...
node.conn[0].iscsi.IFMarker = No
node.conn[0].iscsi.OFMarker = No
# END RECORD

# login to the target

[root@www ~]#
iscsiadm -m node --login

Logging in to [iface: default, target: iqn.2016-06.world.srv:storage.target01, portal: 10.0.0.30,3260] (multiple)
[ 1335.231084] scsi host2: iSCSI Initiator over TCP/IP
[ 1335.242103] scsi 2:0:0:0: Direct-Access     LIO-ORG  disk01           4.0  PQ: 0 ANSI: 5
[ 1335.261069] sd 2:0:0:0: Attached scsi generic sg0 type 0
[ 1335.262275] sd 2:0:0:0: [sda] 20971520 512-byte logical blocks: (10.7 GB/10.0 GiB)
Login to [iface: default, target: iqn.2016-06.world.srv:storage.target01, portal: 10.0.0.30,3260] successful.

# confirm the established session

[root@www ~]#
iscsiadm -m session -o show

tcp: [1] 10.0.0.30:3260,1 iqn.2016-06.world.srv:storage.target01 (non-flash)
# confirm the partitions

[root@www ~]#
cat /proc/partitions

major minor  #blocks  name

 252        0   52428800 sda
 252        1     512000 sda1
 252        2   51915776 sda2
 253        0    4079616 dm-0
 253        1   47833088 dm-1
   8        0   20971520 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

[root@www ~]#
parted --script /dev/sdb "mklabel msdos"

# create partiton

[root@www ~]#
parted --script /dev/sdb "mkpart primary 0% 100%"

# format with XFS

[root@www ~]#
mkfs.xfs -i size=1024 -s size=4096 /dev/sdb1

meta-data=/dev/sdb1        isize=1024   agcount=4, agsize=654848 blks
         =                 sectsz=4096  attr=2, projid32bit=1
         =                 crc=1        finobt=1, sparse=0
data     =                 bsize=4096   blocks=2619392, imaxpct=25
         =                 sunit=0      swidth=0 blks
naming   =version 2        bsize=4096   ascii-ci=0 ftype=1
log      =internal log     bsize=4096   blocks=2560, version=2
         =                 sectsz=4096  sunit=1 blks, lazy-count=1
realtime =none             extsz=4096   blocks=0, rtextents=0

# mount

[root@www ~]#
mount /dev/sdb1 /mnt

[root@www ~]#
df -hT

Filesystem              Type      Size  Used Avail Use% Mounted on
devtmpfs                devtmpfs  2.0G     0  2.0G   0% /dev
tmpfs                   tmpfs     2.0G     0  2.0G   0% /dev/shm
tmpfs                   tmpfs     2.0G  520K  2.0G   1% /run
tmpfs                   tmpfs     2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/mapper/fedora-root xfs        15G  1.1G   14G   8% /
tmpfs                   tmpfs     2.0G  4.0K  2.0G   1% /tmp
/dev/vda1               ext4      477M  100M  349M  23% /boot
tmpfs                   tmpfs     396M     0  396M   0% /run/user/0
/dev/sda1               xfs        10G   33M   10G   1% /mnt
Matched Content
 
Tweet