Jump to content

(cross-posted from Superuser, because it's all crickets over there...)

 

I've been toying around with iSCSI for a little while (FreeNAS 11.1-U5 target, Win10 Pro (1803) initiator) and have run into what would be a bit of a deal-breaking issue: I can't seem to disconnect from an iSCSI target, regardless of what I try. All methods get a "The session cannot be logged out since a device on that session is currently being used" message, and fails to disconnect.

 

What I've tried:

  • Clicking Disconnect in the iSCSI Initiator panel
  • Running the equivalent command in PowerShell
  • Taking the disk offline in Disk Management first
  • Disabling the Microsoft iSCSI Initiator device in Device Manager (requires a reboot, not tenable)
  • Turning the iSCSI service off in FreeNAS (this works eventually, but I'd like to not have to do it this way, if I can help it)
  • Per other sources, I've removed all favorite targets and target portals in the iSCSI properties dialog first

The 'device' is not currently initiated in Windows, and therefore does not have a file system (so, if I understand correctly, cannot be accessed by the OS in a way that would hold the connection open); it's just a disk device at the moment.

 

My preferred behavior would be to disconnect on request (or at least, successfully force disconnect), so I can then connect from another machine, and then back again when necessary.

 

Thanks in advance for any ideas!

 


 

Hardware Details:

Win10 Pro System (desktop): Ryzen 5 1600X, 16GB RAM, NVMe boot drive, Mellanox ConnectX-2 (direct connection to server)

FreeNAS System (server): Core i3-4170, 32GB RAM, 4×10TB in RAIDZ2, Mellanox ConnectX-2 (direct connection to desktop)

Main System (Byarlant): Ryzen 7 5800X | Asus B550-Creator ProArt | EK 240mm Basic AIO | 32GB G.Skill DDR4 3600MT/s CL16 | XFX Speedster SWFT 210 RX 6600 | Samsung 990 PRO 2TB / Samsung 960 PRO 512GB / 4× Crucial MX500 2TB (RAID-0) | Corsair RM750X | Silicom (Intel) X540-AT2 10G NIC | Inateck USB 3.0 Card | Hyte Y60 Case | Dell U3415W Monitor | Keychron K4 Brown (white backlight)

 

Laptop (Narrative): Lenovo Flex 5 81X20005US | Ryzen 5 4500U | 16GB DDR4 3200MT/s (soldered) | Vega II 384SP Graphics | SKHynix P31 1TB NVMe SSD | Intel AX200 Wifi | Asus 2.5G USB NIC | Asus ProArt PA278QV | Keychron K12 Blue (RGB backlight)

 

Proxmox Server (Veda): Ryzen 7 3800XT | ASRock Rack X470D4U | Corsair H80i v2 | 64GB Micron DDR4 ECC 3200MT/s | 4× WD 10TB / 4× Seagate 14TB Exos / 8× WD 12TB (custom external SAS enclosure) / 2× Samsung PM963a 960GB SSD | Seasonic Prime Fanless 500W | Intel X550-T2 10G NIC | LSI 9300-8i HBA | Adaptec 82885T SAS Expander | Fractal Design Node 804 Case

 

Proxmox Server (La Vie en Rose)GMKtec Mini PC | Ryzen 7 5700U | 32GB Lexar DDR4 (SODIMM) | Vega II 512SP Graphics | Lexar 1TB 610 Pro SSD | 2× Realtek 8125 2.5G NICs


Media Center/Video Capture (Jesta Cannon): Ryzen 5 1600X | ASRock B450M Pro4 R2.0 | Noctua NH-L12S | 16GB Crucial DDR4 3200MT/s | EVGA GTX750Ti SC | UMIS NVMe SSD 256GB / TEAMGROUP MS30 1TB | Corsair CX450M | Viewcast Osprey 260e Video Capture | TrendNet (Aquantia AQC107) 10G NIC | LG UH12NS30 BD-ROM | Silverstone Sugo SG-11 Case | Sony XR65A80K

 

Workbench (Doven Wolf): Lenovo m715q | Ryzen Pro 3 2200GE | 16GB Crucial DDR4 3200MT/s (SODIMM) | Vega 8 Graphics | SKHynix (OEM) 256GB NVMe SSD | uni 2.5G USB NIC | HDMI add-in module

 

Network:

Spoiler
                       ┌─────────────── Office/Rack ───────────────────────────────────────────────────────┐
Google Fiber Webpass ── Cloud Gateway Max ═╦════ Flex 2.5-8 ═╦════ Flex XG ═╦═ Veda
                           La Vie en Rose ═╣ La Vie en Rose ═╬═ Doven Wolf  ╠═ Veda-NAS
                                     Veda ─╜      Narrative ═╝              ╟─ Switch 8-60W ─┬─ Veda
╔═══════════════════════════════════════════════════════════════════════════╝                └─ Veda (IPMI)
║    ┌ Closet ┐     ┌───────── Bedroom ─────────┐
╚════ Flex XG ═╦╤═══ Flex XG ═╤╦═ Byarlant
        (PoE)  ║│             │╠═ Narrative 
Kitchen Jack ══╣└─ Dual PoE ┐ │╚═ Jesta Cannon*
   (Testing)   ║┌─ Injector ┘ └── Work Laptop
     Bedroom ══╝│
        Jack #2 │        ┌──────── Media Center ───────────────────────────┐
                └──────── Switch 8 ────────────┬─ nanoHD Access Point (PoE)
Notes:                                         ├─ Sony PlayStation 4 
─── is Gigabit / ═══ is Multi-Gigabit          ├─ Pioneer VSX-S520
* = cable passed from Bedroom to Media Center  └─ Sony XR65A80K (Google TV)

 

Link to comment
https://linustechtips.com/topic/1008639-force-iscsi-disconnect/
Share on other sites

Link to post
Share on other sites

If you turn the computer off and on again you should be able to click disconnect and it should work. I've had this issue.

 

I just say though is iSCSI a necessity? I played with it for a while myself and found there's no real benifit to using it unless you have a real specific application for it like a program that only works with local disks but you want the functionality of zfs or a remote system that manages your drives.

 

You're more likely better off sticking with SMB. This PC can let you set it up as a network drive so it shows up with a drive letter making it more easily accessible.

Link to comment
https://linustechtips.com/topic/1008639-force-iscsi-disconnect/#findComment-12083963
Share on other sites

Link to post
Share on other sites

  • 7 months later...
  • 1 month later...
On 8/12/2019 at 6:29 PM, FECV said:

Just ran into this issue on Server 2019 so pretty much Windows 10 and my solution was stupid. I had task manager open which monitors disk I/O and once i closed that iSCSI initiator disconnected normally.

I know this is an old post, but I've always had this problem in various WIndows Server OSes and it was so consistent that I had just assumed that it was Windows being Windows. I finally got fed up and decided to revisit the issue again when I came across this post.

 

I almost always have Task Manager open, and I found that closing it resolved the issue for me as well. I did, however want to add some additional clarification:

 

While closing Task Manager fixed the issue, it is not the actual root of the problem. The problem is having Task Manager open with disk performance counters enabled. By default, these counters are disabled on Windows Server 2012/2012 R2/2016/2019; however, I would generally enable them on my Windows Server installs by opening the command prompt (or PowerShell) as an administrator and entering the following command:

diskperf -Y

The disk performance counters can also be disabled using the same command:

diskperf -N

This unfortunately hides the disk performance metrics in Task Manager, but I no longer receive a "The session cannot be logged out since a device on that session is currently being used." message when attempting to disconnect an iSCSI volume with Task Manager open. I don't even need to take the volume offline first; it just works. It's still best practice to take the volume offline from the disk management screen first though, just in case some other process is trying to access it.

Link to comment
https://linustechtips.com/topic/1008639-force-iscsi-disconnect/#findComment-12962632
Share on other sites

Link to post
Share on other sites

Task manager open will often also tell you "the disk is in use" when trying to safely eject a regular USB drive. Took me a while to link the 2, mostly becasue I never do it for drives other than my backup sets.

F@H
Desktop: i9-13900K, ASUS Z790-E, 64GB DDR5-6000 CL36, RTX3080, 2TB MP600 Pro XT, 2TB SX8200Pro, 2x16TB Ironwolf RAID0, Corsair HX1200, Antec Vortex 360 AIO, Thermaltake Versa H25 TG, Samsung 4K curved 49" TV, 23" secondary, Mountain Everest Max

Mobile SFF rig: i9-9900K, Noctua NH-L9i, Asrock Z390 Phantom ITX-AC, 32GB, GTX1070, 2x1TB SX8200Pro RAID0, 2x5TB 2.5" HDD RAID0, Athena 500W Flex (Noctua fan), Custom 4.7l 3D printed case

 

Asus Zenbook UM325UA, Ryzen 7 5700u, 16GB, 1TB, OLED

 

GPD Win 2

Link to comment
https://linustechtips.com/topic/1008639-force-iscsi-disconnect/#findComment-12962671
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×