Managing ISCSI in LINUX (REDHAT 7.1)
iSCSI is a block protocol for storage networking and runs the very common SCSI storage protocol across a network connection which is usually Ethernet. iSCSI, like Fibre Channel, can be used to create a Storage Area Network (SAN). iSCSI traffic can be run over a shared network or a dedicated storage network.
Accessing ISCSI Storage on Linux environment works in phase wise.
- Setup an Initiator node
- Discover the initiator node
- Login to the initiator node
- Access the block storage, create filesystem, mount and use
- Logout of initiator node.
- Setup and initiator node.
Install all the utilities required to administrate the ISCSI devices in the environment. Usually these packages comes in built if you have gone for installing the "Full installation of server" while setting/building up the server.
# yum install iscsi-initiator-utils
2. Discover the target
# iscsiadm -m discover, discoverydb, node,
-t send targets,SLP, iSNS,fw
-p port
# iscsiadm -m discover -t st -p (Syntax)
# iscsiadm -m discover -t st -p 192.168.0.12:3260
-m ==> Mode
-t ==> Type
-p ==> Port
Type
send targets :- Native ISCSI Protocol allows each iscsi target to send available targets to the initiator.
SLP :- Service level protocol used for announcing available targets
iSNS :- Internet STORAGE NAME SERVICE records the volume of targets available in the wide area network.
fw :- NIC's and systems which are used for keeping the boot images or boots away from the initiator ( Obsolete and not used in any live environment)
# iscsiadm -m discover -t st -p 192.168.0.12:3260,1 iqn.2006-04.example:3260
3. Login to the target
# iscsiadm -m node -T <Target Name> -p <Portal:port> -l
# iscsiadm -mo node -T iqn.2006-04.example:3260 -l
4. Access the block storage and mount the filesystems
# grep -i "attached scsi" /var/log/messages
# mkfs.ext4 /dev/<diskName>
# mount /dev/disk_name /mount_point
# echo "/dev/diskname /mount_point _netdev 0 0" >>/etc/fstab
5. Logout of iscsi target
# iscsiadm -m node -T iqn.2006-04.example:3260 -p 192.168.0.12:3260 -u
Note :- LOGOUT is essential for "The
sendtargets
command used to retrieve --targetname
and --portal
values overwrites the contents of the /var/lib/iscsi/nodes
database. This database will then be repopulated using the settings in /etc/iscsi/iscsid.conf
. However, this will not occur if a session is currently logged in and in use."Troubleshooting ISCSI Devices
if the iSCSI devices are not found then perform rescan
# iscsiadm -m node --rescan
If a lun is resized at NETAPP level it will reflect on the host side and the filesystem can be resized online without resulting in downtime to the filesytem.
# echo 1 > /sys/block/sdX/device/rescan