Fedora 21
Sponsored Link

Configure iSCSI Initiator2014/12/13

 
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 ~]#
yum -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.2014-12.world.srv:www.srv.world
[root@www ~]#
vi /etc/iscsi/iscsid.conf
# line 54: uncomment

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

node.session.auth.username =
username

node.session.auth.password =
password
[root@www ~]#
systemctl start iscsid

[root@www ~]#
systemctl enable iscsid
# discover target

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

10.0.0.30:3260,1 iqn.2014-12.world.srv:storage.target00

# confirm status after discovery

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

# BEGIN RECORD 6.2.0.873-24
node.name = iqn.2014-12.world.srv:storage.target00
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.2014-12.world.srv:storage.target00, portal: 10.0.0.30,3260] (multiple)
Login to [iface: default, target: iqn.2014-12.world.srv:storage.target00, 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.2014-12.world.srv:storage.target00 (non-flash)
# confirm the partitions

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

major minor  #blocks  name

  11        0    1999872 sr0
   8        0  157286400 sda
   8        1     512000 sda1
   8        2  156773376 sda2
 253        0   52428800 dm-0
 253        1    6225920 dm-1
 253        2   98050048 dm-2
   8       16   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 EXT4

[root@www ~]#
mkfs.ext4 /dev/sdb1

# mount

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

[root@www ~]#
df -hT

Filesystem                      Type      Size  Used Avail Use% Mounted on
/dev/mapper/fedora--server-root ext4       50G  1.4G   46G   3% /
devtmpfs                        devtmpfs  6.0G     0  6.0G   0% /dev
tmpfs                           tmpfs     6.0G     0  6.0G   0% /dev/shm
tmpfs                           tmpfs     6.0G  564K  6.0G   1% /run
tmpfs                           tmpfs     6.0G     0  6.0G   0% /sys/fs/cgroup
tmpfs                           tmpfs     6.0G     0  6.0G   0% /tmp
/dev/sda1                       ext4      477M  116M  332M  26% /boot
/dev/mapper/fedora--server-home ext4       92G   60M   88G   1% /home
tmpfs                           tmpfs     1.2G     0  1.2G   0% /run/user/0
/dev/sdb1                       ext4       20G   44M   19G   1% /mnt
Matched Content