Linux – How to determine if an iscsi device is a mounted Linux filesystem

iscsilinux

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.

Best Answer

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.