====== iSCSI ====== **General Information** iSCSI operations on Linux. **Checklist** * Distro(s): Enterprise Linux 6/7 ---- ====== Adding Disks ===== - Get the iscsi initiator name on the clientcat /etc/iscsi/initiatorname.iscsi - Use the initiator name to configure the Host Group, LUN, and Host Affinity on your storage device. (Or send the initiator name to the storage admin) - From the client, discover the available LUNs on the storage deviceiscsiadm --mode discovery -t sendtargets --portal - Start and enable the iscsi daemon - EL6service iscsid start chkconfig iscsid on - EL7systemctl start iscsid systemctl enable iscsid - Log-in to the LUN with the iscsi clientiscsiadm --mode node --targetname --portal : --login - Create /etc/multipath.conf if it doesn't existmpathconf --enable - Configure multipathvim /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 } } - Start and enable multipathd - EL6service multipathd start chkconfig multipathd on - EL7systemctl start multipathd systemctl enable multipathd - Re-scan the scsi busecho "- - -" > /sys/class/scsi_host//scan - Where is something like: host0 (there will probably be host0-3) - The hyphens represent controller,channel,lun, so – - – indicates all controllers, all channels, and all luns should be scanned. - Verify pathsmultipath -ll - Add mount entry to /etc/fstab ---- ====== Clean Device Removal ====== Red Hat's recommended procedure for removing storage devices. - Ensure all files open on the device are closedlsof | grep - Backup/move data as needed - Remove device from any software RAID or LVM volume - Remove device from multipath - Flush outstanding I/O (important for raw devices)blockdev --flushbufs - Remove references to the device from applications, scripts, etc. - Remove each path to the device from the SCSI subsystemecho 1 > /sys/block//device/delete - Where can be something like 'sde' ---- ====== iSCSI Admin ====== 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 --portal 192.168.1.100:3260 --login Disable iscsi target: Logout from iscsi target iscsiadm --mode node --targetname --portal 192.168.1.100:3260 --logout Delete iscsi target iscsiadm --mode node -o delete --targetname --portal 192.168.1.100:3260 ---- ===== Related Multipath Commands ===== 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 * EL6service multipathd restart * EL7systemctl restart multipathd ----