To successfully disconnect an iscsi-mounted device in windows…
- In disk manager, in lower portion of screen, right-click on the disk itself (on the left hand side, not the partitions on the right), and select
Offline
- in the iSCSI Initiator app:
- in the
Favourite Targets
tab, select the item and chooseRemove
- in the
Targets
tab select the item and clickDisconnect
- in the
- This may fail e.g. with the message:
The session cannot be logged out since a device on that session is currently being used.
- if so, this may be due to windows Task Manager running which, if disk performance counters are enabled, holds the device open.
- Close all open task manager instances
- If disk performance counters are not required, to prevent this happening again, at an administrator powershell/command prompt, issue
diskperf -N
Thanks
Useful info about task manager/performance counters was found here