Jump to content

Force iSCSI Disconnect

AbydosOne

(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 | 16GB G.Skill DDR4 3200MT/s CAS-14 | XFX Speedster SWFT 210 RX 6600 | Samsung 990 PRO 2TB / Samsung 960 PRO 512GB / 4× Crucial MX500 2TB (RAID-0) | Corsair RM750X | Mellanox ConnectX-3 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 RAM (soldered) | Vega 6 Graphics | SKHynix P31 1TB NVMe SSD | Intel AX200 Wifi (all-around awesome machine)

 

Proxmox Server (Veda): Ryzen 7 3800XT | AsRock Rack X470D4U | Corsair H80i v2 | 64GB Micron DDR4 ECC 3200MT/s | 4x 10TB WD Whites / 4x 14TB Seagate Exos / 2× Samsung PM963a 960GB SSD | Seasonic Prime Fanless 500W | Intel X540-T2 10G NIC | LSI 9207-8i HBA | Fractal Design Node 804 Case (side panels swapped to show off drives) | VMs: TrueNAS Scale; Ubuntu Server (PiHole/PiVPN/NGINX?); Windows 10 Pro; Ubuntu Server (Apache/MySQL)


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

 

Camera: Sony ɑ7II w/ Meike Grip | Sony SEL24240 | Samyang 35mm ƒ/2.8 | Sony SEL50F18F | Sony SEL2870 (kit lens) | PNY Elite Perfomance 512GB SDXC card

 

Network:

Spoiler
                           ┌─────────────── Office/Rack ────────────────────────────────────────────────────────────────────────────┐
Google Fiber Webpass ────── UniFi Security Gateway ─── UniFi Switch 8-60W ─┬─ UniFi Switch Flex XG ═╦═ Veda (Proxmox Virtual Switch)
(500Mbps↑/500Mbps↓)                             UniFi CloudKey Gen2 (PoE) ─┴─ Veda (IPMI)           ╠═ Veda-NAS (HW Passthrough NIC)
╔═══════════════════════════════════════════════════════════════════════════════════════════════════╩═ Narrative (Asus USB 2.5G NIC)
║ ┌────── Closet ──────┐   ┌─────────────── Bedroom ──────────────────────────────────────────────────────┐
╚═ UniFi Switch Flex XG ═╤═ UniFi Switch Flex XG ═╦═ Byarlant
   (PoE)                 │                        ╠═ Narrative (Cable Matters USB-PD 2.5G Ethernet Dongle)
                         │                        ╚═ Jesta Cannon*
                         │ ┌─────────────── Media Center ──────────────────────────────────┐
Notes:                   └─ UniFi Switch 8 ─────────┬─ UniFi Access Point nanoHD (PoE)
═══ is Multi-Gigabit                                ├─ Sony Playstation 4 
─── is Gigabit                                      ├─ Pioneer VSX-S520
* = cable passed to Bedroom from Media Center       ├─ Sony XR65A80K (Google TV)
** = cable passed from Media Center to Bedroom      └─ Work Laptop** (Startech USB-PD Dock)

 

Retired/Other:

Spoiler

Laptop (Rozen-Zulu): Sony VAIO VPCF13WFX | Core i7-740QM | 8GB Patriot DDR3 | GT 425M | Samsung 850EVO 250GB SSD | Blu-ray Drive | Intel 7260 Wifi (lived a good life, retired with honor)

Testbed/Old Desktop (Kshatriya): Xeon X5470 @ 4.0GHz | ZALMAN CNPS9500 | Gigabyte EP45-UD3L | 8GB Nanya DDR2 400MHz | XFX HD6870 DD | OCZ Vertex 3 Max-IOPS 120GB | Corsair CX430M | HooToo USB 3.0 PCIe Card | Osprey 230 Video Capture | NZXT H230 Case

TrueNAS Server (La Vie en Rose): Xeon E3-1241v3 | Supermicro X10SLL-F | Corsair H60 | 32GB Micron DDR3L ECC 1600MHz | 1x Kingston 16GB SSD / Crucial MX500 500GB

Link to comment
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
Share on other sites

Link to post
Share on other sites

  • 7 months later...

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.

Link to comment
Share on other sites

Link to post
Share on other sites

  • 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
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
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

×