General Information
iSCSI operations on Linux.
Checklist
cat /etc/iscsi/initiatorname.iscsi
iscsiadm --mode discovery -t sendtargets --portal <storage-ip-address>
service iscsid start chkconfig iscsid on
systemctl start iscsid
systemctl enable iscsid
iscsiadm --mode node --targetname <iqn-LUN#-here> --portal <storage-ip-address>:<port> --login
mpathconf --enable
vim /etc/multipath.conf # Blacklist exception for your device blacklist_exceptions { # WWN of LUN via iSCSI LUN group wwid "123456789" } # Setup your storage device specifics devices { device { vendor "DELL" product "MODEL-HERE" # specify other options } } # Setup the multipath multipaths { multipath { wwid 123456789 alias friendly_name_here } }
service multipathd start chkconfig multipathd on
systemctl start multipathd
systemctl enable multipathd
echo "- - -" > /sys/class/scsi_host/<host_number>/scan
multipath -ll
Red Hat's recommended procedure for removing storage devices.
lsof | grep <devname>
blockdev --flushbufs <device>
echo 1 > /sys/block/<device-name>/device/delete
Example iscsiadm commands.
View iscsi target node IP addresses and target names
iscsiadm --mode node
Enable iscsi target: Login to iscsi target
iscsiadm --mode node --targetname <iscsi-target-name> --portal 192.168.1.100:3260 --login
Disable iscsi target: Logout from iscsi target
iscsiadm --mode node --targetname <iscsi-target-name> --portal 192.168.1.100:3260 --logout
Delete iscsi target
iscsiadm --mode node -o delete --targetname <iscsi-target-name> --portal 192.168.1.100:3260
If the iSCSI device that is removed is also multipath'd, remove it from multipath configuration also.
View multipath devices
multipath -ll
Remove (flush) an unused multipath device
multipath -F
After, restart multipathd to ensure it doesn't come back
service multipathd restart
systemctl restart multipathd