3

EDIT: This is on a Debian 7 sytstem (more accurately Proxmox hypervisor https://www.proxmox.com/en/) 2.6.32-48-pve kernel.

I have a disk partition as an iscsi target on my backend infiniband storage. I've mounted the target locally on the initiator (on /mnt/iscsi). If I need to reboot the initiator, I need to unmount /mnt/iscsi and then logout of the portal prior to rebooting (at least it was this way a couple years ago. been a while since I've worked with iscsi).

How can I determine which filesystems are mounted over iscsi? The regular mount command just displays the block device which was created by the initiator eg: /dev/sdc.

/dev/sdc on /mnt/iscsi type ext4 (rw,relatime,barrier=1,data=ordered)

I'd like to automate the unmount/logout prior to a reboot but this information is not enough to determine if the filesystem in question needs to be run through iscsiadm ... --logout after unmounting.

2
  • Can you provide information on the actual Linux distribution and version in use? – ewwhite Jan 24 '17 at 23:17
  • Good idea. Added. – Server Fault Jan 25 '17 at 15:00
5

Try iscsiadm -m session -P 3 and check the last section "Attached SCSI devices"

Just FYI: If you set iscsid to start on boot you do not need to unmount/logout iSCSI partitions prior to reboot. As long as the partition is in /etc/fstab and has a _netdev option.

3
  • Thanks for the iscsid info. The daemon is running, however I don't see an init script for it. This is a vended product built on Debian 7 so they may have made some customizations in regards to iscsi initialization. – Server Fault Jan 25 '17 at 15:02
  • If it were for RHEL or CentOS, the netfs service handles this. – ewwhite Jan 25 '17 at 16:02
  • iscsiadm -m session -P 3 works as noted to show device in use by target. Thanks! – Server Fault Jan 26 '17 at 16:09
1

Try this command:

iscsiadm -m session -P 3 | grep 'Target\|disk'

The iscsiadm utility is a command-line tool allowing discovery and login to iSCSI targets, as well as access and management of the open-iscsi database.

-m, --mode op specifies the mode. op must be one of discoverydb, node, fw, host iface or session. This command will list the sessions targets (and grep within the result).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.