VMware Communities
voidp
Enthusiast
Enthusiast
Jump to solution

Workstation 10: Windows "Safely Remove" Gone Wild

I'm using VMware Workstation 10.0.0 build-1295980 to host Microsoft Windows Server 2012 R2.  Unfortunately, Windows' Safely Remove's menu lists several hardware devices that never appear when Windows is installed on physical hardware.  Does anyone know how to suppress such menu items so that only legitimately removable media (like USB thumb drives) are displayed?

Here's the Safely Remove icon that appears in the Windows Taskbar's notification area:

Safely Remove (icon).png

Here's the Windows Server 2012 R2 Safely Remove menu when running as a guest on VMware Workstation 10.0.0 build-1295980:

Safely Remove (menu).png

1 Solution

Accepted Solutions
dariusd
VMware Employee
VMware Employee
Jump to solution

Hi voidp, and welcome to the VMware Communities!

You've found a feature!  Our virtual machines support virtual PCI/PCIe hot-add and hot-remove, so those devices should actually be ejectable.  The physical host you are comparing against obviously doesn't support PCI/PCIe hotplug.  :smileygrin:

If you don't want those items showing up in the "Safely Remove" list regardless, power off and snapshot your VM, then try using your favorite text editor to open the ".vmx" file inside the virtual machine's directory, and add

   devices.hotplug = "FALSE"

to the VM's configuration.  When you power it on again, those devices should no longer be hot-removable.  I have absolutely no idea how Windows will take that change... it might get horribly confused about this unusual modification to its "motherboard"... so please be sure to take a snapshot before trying this!

Cheers,

--

Darius

View solution in original post

14 Replies
dariusd
VMware Employee
VMware Employee
Jump to solution

Hi voidp, and welcome to the VMware Communities!

You've found a feature!  Our virtual machines support virtual PCI/PCIe hot-add and hot-remove, so those devices should actually be ejectable.  The physical host you are comparing against obviously doesn't support PCI/PCIe hotplug.  :smileygrin:

If you don't want those items showing up in the "Safely Remove" list regardless, power off and snapshot your VM, then try using your favorite text editor to open the ".vmx" file inside the virtual machine's directory, and add

   devices.hotplug = "FALSE"

to the VM's configuration.  When you power it on again, those devices should no longer be hot-removable.  I have absolutely no idea how Windows will take that change... it might get horribly confused about this unusual modification to its "motherboard"... so please be sure to take a snapshot before trying this!

Cheers,

--

Darius

WoodyZ
Immortal
Immortal
Jump to solution

I've used the devices.hotplug = "FALSE" option for some time now and not had any issues with using it! Smiley Wink

Reply
0 Kudos
dariusd
VMware Employee
VMware Employee
Jump to solution

Yeah, my concern is not with the option itself, but with it being applied to a VM which has already populated its registry with a description of a motherboard which supports PCI hotplug... and then suddenly discovering that the feature is missing.

Reply
0 Kudos
WoodyZ
Immortal
Immortal
Jump to solution

I've added it after the fact and not had any issues however your advice to snapshot first is on target! Smiley Wink

Reply
0 Kudos
voidp
Enthusiast
Enthusiast
Jump to solution

Hello daruisd,


Adding devices.hotplug = "FALSE" to the .vmx file successfully prevented PCI[e] hotplug devices from appearing in Windows' Safely Remove list.  Moreover, it didn't interfere with any of the traditional (USB) removable devices I added to the guest.  In the future I'll add this to my .vmx files prior to installing Windows operating systems.

I did see this solution for other VMware products (e.g., ESX) but not Workstation in particular.  It wasn't in the Workstation 10 documentation or online help.  Is it documented anywhere?  (Is there a clearinghouse for Workstation .vmx settings?)

Regarding a related issue, I discovered that VMware Workstation's SATA CD/DVD drive hardware also appears in Safely Remove.  This is expected because its device capabilities include CM_DEVCAP_REMOVABLE.  However, is there a configuration setting to make it behave like a non-removable (internal) drive?

cdrom.png

-viodp

dariusd
VMware Employee
VMware Employee
Jump to solution

Hi voidp!

To get rid of the DVD drive from that list, try setting

   ahci.port.hotplug.enabled = "FALSE"

That should stop Workstation from reporting the SATA ports as hot-pluggable, which I think should make the drive non-ejectable (but the media should still be ejectable, of course).

There is no official clearinghouse of VM settings, although we've had quite a few requests lately for just such a thing.  The best resource presently available is forum ultra-guru Continuum's list at sanbarrow.com.  One problem with documenting everything is that the presently-undocumented settings are often difficult to fully support (or even characterize) in the general case... Some of them have surprising side-effects which might vary by guest OS and by Workstation/Fusion/ESXi release, and some of them are just downright dangerous in the hands of an inexperienced user.  Some will potentially lead to performance problems, security problems, guest OS instability, or just about any other undesirable behavior you could imagine.

Disabling SATA hotplug for a Windows guest should be fine, though. :smileygrin:

Hope this helps!

--

Darius

voidp
Enthusiast
Enthusiast
Jump to solution

Hello dariusd,

Adding ahci.port.hotplug.enabled = "FALSE" to the .vmx file successfully prevented the SATA CD/DVD hardware from appearing in Windows' Safely Remove list.  Moreover, it didn't interfere with ejecting media.

I'm grateful to you and VMware for providing such excellent support during late night weekend hours!

-vp

Reply
0 Kudos
engineer71
Contributor
Contributor
Jump to solution

Hot pluggable devices would be useful, but there should be a limit.  Why are there 30 of these things, but I have only ONE disk specified (and It's SCSI)?  Is there a way to disable the ATA controller entirely, or set it to a more realistic value of two channels?

Reply
0 Kudos
dariusd
VMware Employee
VMware Employee
Jump to solution

Could you please provide a few more details?  What are you seeing in the menu?  What is the Windows version you are using in the guest?  Which version of Workstation are you using?

If you're referring to SATA ports, we should be reporting empty ports as such... it would be unusual for the guest OS to offer ejection of an empty port, but it's not impossible...

Thanks,

--

Darius

Reply
0 Kudos
engineer71
Contributor
Contributor
Jump to solution

Darius,

The guest OS is Windows 7 SP1 64-bit with all updates.

The VM is VMWare Workstation Player 12.5.0 build-4352439, but it has happened in Workstation Player 12.1, Workstation Player 7, Workstation 10, and other versions.

There is no ATA controller configured.  Only Serial ATA for the CD drive, and you can see the VHD booted from at the very bottom of the list. There should not be any ATA channels at all, because I only have one VHD and it's a SCSI.  There is no eject option for the other 6 or 13 devices that could be put on the SCSI chain.  Thank you for your help.

VM Config:

pastedImage_0.png

Issue is here:

pastedImage_3.png

Reply
0 Kudos
dariusd
VMware Employee
VMware Employee
Jump to solution

Our SATA controller has 30 ports, and SATA is just Serial ATA, so they are ATA channels after all.

Newer versions of Windows don't do what you are seeing there, when presented with the same hardware emulation.  It is possible that it might be a quirk of Windows 7 with SATA hotplug.

If you want to restrict the number of ports implemented in the SATA controller, power off the VM and add the following config option to the .vmx file, for example:

    sata0.numPorts = "2"

This will of course limit the number of SATA devices you can attach to the virtual machine, but will still allow hotplug on the configured ports.

Cheers,

--

Darius

engineer71
Contributor
Contributor
Jump to solution

Darius,

I expected SATA ports would say SATA in the name in Windows Device Manager, not "ATA Channel" (like "SATA Channel 0" or something),  legacy ATA devices reported the way in screenshot 1, the kind with the 40-pin ribbon cable.

The bottom image is a screenshot showing legacy ATA adapters on a physical machine (from https://ttcshelbyville.files.wordpress.com/2009/12/windows-7-speed-test.jpg).

The option [ sata0.numPorts = "2" ] did indeed lower the number of items displayed in the list to 2.  Changing this setting to Zero does not work, for anyone who might want to know.

Thanks for the help!



pastedImage_1.png

Legacy ATA screenshot:

https://ttcshelbyville.files.wordpress.com/2009/12/windows-7-speed-test.jpg

Reply
0 Kudos
dariusd
VMware Employee
VMware Employee
Jump to solution

I expected SATA ports would say SATA in the name in Windows Device Manager, not "ATA Channel"

Unfortunately, the way the OS labels the SATA ports is entirely under the control of the OS and its AHCI driver, and is not within VMware's control (unless VMware was to provide its own AHCI driver for Windows, which would be a lot of otherwise-unnecessary work).  My guess is that Windows 7 has immature support for SATA hotplug, leading to these non-ideal port names (even though they are technically still correct) and the appearance of empty hotpluggable ports in the list of removable devices.  As I said, these problems do not occur with newer versions of Windows, even when we've made no changes to the emulated SATA controller, suggesting strongly that it's an issue with the OS itself.

The option [ sata0.numPorts = "2"] did indeed lower the number of items displayed in the list to 2.  Changing this setting to Zero does not work, for anyone who might want to know.

Sorry, I failed to explain what that option actually does.  It doesn't just directly remove entries from that list... It limits the number of ports that our virtual SATA controller provides.  Think of it like deciding when you're buying a physical motherboard with a certain number of SATA ports... When our motherboard has a SATA controller, it provides 30 ports by default (in most cases).  Setting sata0.numPorts allows you to specify that you won't ever need 30 ports, so you are choosing a virtual motherboard with fewer SATA ports.  If you reduce the number of SATA ports to zero, you wouldn't be able to attach any SATA devices to the VM at all and the SATA controller would be useless – you'd be better served by changing the VM to use only IDE/SCSI devices and removing the SATA controller, perhaps.

Cheers,

--

Darius

ShawnMcC
Contributor
Contributor
Jump to solution

This solution also works for vSperhere ESXi 6.7 U3. Normally Windows 10 guests with additional hard drives are listed as removable.  With this solution, they are fixed disks.

I need this behavior so that I can use BitLocker on drives other than C:

Reply
0 Kudos