How to prevent and remove ‘phantom’ devices

Fred langa By Fred Langa

A little ghostbusting is all it takes to free your system of nonexistent devices.

Windows sometimes displays USB drives and other removable devices that are no longer connected to your system. Here’s how to cure the problem and prevent it from happening again.

Keep phantom devices at bay

Have you ever had Windows show you a device — perhaps a USB drive or other removable device — that’s no longer connected to your system? When this happens, you can run into trouble if software tries to access the phantom device.

Subscribe to our Windows Secrets Newsletter - It's Free!

Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

Windows 8.1: Out of the box

Subscribe and get our monthly bonuses - free!

Get a real feel for Windows 8.1 with a wealth of tips in this step-by-step guide. This month, Windows Secrets subscribers can download the first 2 chapters for free: Using Windows 8.1 and Using Email and the Internet. Get this excerpt and other 5 bonuses if you subscribe now!



Or, because the nonexistent device is still consuming a drive letter assignment and/or other resources, you may have problems when you add additional devices that need the already-assigned resources. I’ve seen some cases where people were running out of drive letters because their systems were maintaining a whole flock of phantom drives!

Let’s begin with ways to prevent the phantom devices from appearing in the first place. Then, we’ll come back to removing any that may already be there.

Phantom devices can appear for any number of reasons. Perhaps the most common reason is a shutdown error with a removable drive. Most people don’t know this, but there are actually three different ways to disconnect a removable drive. Two are correct, and one isn’t.

Here’s the official word from Microsoft on the two correct ways of removing an external or hot-swappable disk (or other device), as described in the Windows XP Professional Resource Kit:
  • “If the Safely Remove Hardware icon appears in the taskbar notification area, you must use [it]. If the Safely Remove Hardware icon is not in the notification area, you must use Device Manager to uninstall the disk before you unplug it.”
The third, improper method is the one almost all of us use: We simply unplug the device. In fact, this usually works, as long as the device isn’t actively being written to or read from. You unplug the device, hear the audible "device unplugged" confirmation tones (a descending "ding-dong"), and that’s that.

But note Microsoft’s use of the word "must" in the above quote: You must use the Safely Remove Hardware method — if it’s available. It’s not a mere suggestion or recommendation. Microsoft says it’s a must.

That’s because simply unplugging a device (the way most of us do) runs the risk of losing data through a delayed write, or open file, or similar problem. You also risk leaving behind a phantom drive or other resource assignment, because the OS doesn’t realize the device is gone.

You can avoid these problems by using either the Safely Remove Hardware method or the Device Manager method. They ensure that all writes or other pending operations are completed, that any open files are closed, and that the OS knows it can free up whatever resource assignments the device was using.

To put it another way, go ahead and simply unplug your removable devices if you wish. Most times, it’ll work perfectly fine. But if it doesn’t and you end up with phantom drives or other problems, you’ll know why!

Of course, there are still are some pitfalls you need to watch out for — after all, this is Windows we’re talking about, and nothing is quite as simple as we might wish. Plus, there remains the question of what to do if your system is already carrying a flock of phantom drives. I’ll cover that in the items below.

Restoring the HotPlug Manager

OK, so know we know that we’re supposed to use the Safely Remove Hardware method to disconnect removable devices. But what happens if the Safely Remove Hardware icon goes AWOL on you? Or, what if you click it, but it doesn’t do anything? And what if you already have phantom drives on your system? How do you get rid of them?

The Safely Remove Hardware icon is actually a shortcut to Windows’ HotPlug Manager. This service normally launches automatically when you connect a recognized USB or Firewire device to your system.

Safely remove hardware
Figure 1. The HotPlug Manager can be accessed via the Safely Remove Hardware icon, which normally appears in the Notification Area by the clock.

But, as with all software, things sometimes go awry. The HotPlug Manager occasionally hangs or fails to launch, meaning that the Safely Remove Hardware icon won’t appear, even when you know it should. In this case, the simple fix is to manually launch the HotPlug Manager by opening the Start, Run dialog and typing the following:

RunDll32.exe shell32.dll,Control_RunDLL HotPlug.dll

Click OK, and the HotPlug Manager’s Safely Remove Hardware icon should appear. Its dialog box should open and display any connected devices. That’s all it takes!

If only it were so simple. Unfortunately, not all devices cooperate with the HotPlug Manager. If you connect an unrecognized device to your system and the Safely Remove Hardware icon doesn’t appear — and manually launching the HotPlug Manager doesn’t help — it may be that the device simply won’t work with the HotPlug Manager. (It’s not very common, but it happens.)

To safely remove such an unrecognized device, you’ll have to use Device Manager to uninstall the device prior to disconnecting. (One way to access Device Manager is via Control Panel, Performance & Maintenance, System, Hardware, Device Manager.)

You may sometimes encounter a separate problem, too: The Safely Remove Hardware icon may be present, but won’t do anything when you click it. This problem doesn’t affect many systems, but if it affects yours, Microsoft has a hotfix for you — KB 883517.

The techniques above will help you properly shut down and remove devices from your system and should keep phantom devices from populating your system in the future. But, if you already have such phantoms in your PC, here’s the quick-and-dirty method I use when I have to clean up any kind of ghost device in my system, or when a known-good device’s settings become hopelessly bollixed:

Open Device Manager and uninstall not only the offending device itself, but also (if possible) any device that directly controls the offending device. On reboot, Windows will rediscover and reinstall the hardware, freshly reconfiguring the devices that are present and ridding the system of ghost devices.

For example, if I’m having a problem with disk drives, I may uninstall the drives and the drive controllers in Device Manager. On reboot, Windows will rediscover the controllers first, and then set up the drives afresh.

Or, if I’m having a USB problem, I’ll uninstall the USB Root Hubs and Controllers in Device Manager. On reboot, Windows will sort things out from scratch, leaving behind a freshly-configured, phantom-free setup.

This brute-force approach surely isn’t elegant, but it’s fast and it works. And, if you have current and complete backups, there’s essentially no risk to it.

Free virtual CD-ROM drive from Microsoft

I recently rediscovered a nifty free tool from Microsoft. You may find it useful, too.

It’s the Microsoft Virtual CD-ROM Control Panel. The download is a self-extracting archive that contains three files: the front end (VCdControlTool.exe), the virtual CD driver (VCdRom.sys), and a readme file. The latter contains the basic instructions for using the tool.

To understand how it works, you need to know about ISO files — a kind of disk image of a standard CD. Many large downloadable software packages (including most Linux distributions) are packaged as ISO files. These files contain not only the data that’s on the original CD, but also information about how the CD is structured and formatted.

Normally, an ISO file has to be processed by special software to separate the stored data from the formatting information. The software then uses the formatting data in the ISO file to burn an exact duplicate of the original CD’s contents. Most normal CD-burning tools have a built-in way to do this. In Roxio’s Creator Classic, for example, it’s under the Record Disc From Image option on the File menu.

But sometimes, you don’t want the entire contents of a CD. You may instead just want to extract one file from the ISO image. Or, perhaps you’d like to test-drive software before committing it to a physical CD. Or, you may be in a situation (such as with a laptop computer) where you only have one CD drive but would like to be able to access two or more CDs simultaneously. Or, maybe you’re bogged down by having to process large amounts of data from a relatively slow CD, and you’d much prefer to access the data at hard-drive speeds.

That’s where the Virtual CD-ROM Control Panel comes in. It lets you mount an ISO file of a CD in one step, without having to burn it to an actual, physical CD first. You then have access to the full contents of the CD and can get at any or all of the data.

The Virtual CD-ROM Control Panel also lets you mount several images at once, each with its own drive letter. I don’t know what the upper limit is, but I’ve had as many as four ISOs mounted at once, in addition to the two real CD drives in my system. And, of course, because the ISO files actually reside on your hard drive, you can access them at normal hard-drive speeds, which are usually much, much faster than CD drives.

There are other, similar tools out there, but this one’s free, and works well. Very, very handy!

Another free tool — TCP/IP optimizer

Reader Wendell Britnell pointed out a nice addition to the information already presented in “Optimizing Your Network Connections” in the Mar. 15 issue. He visited Speedguide.net and was very impressed by its TCP/IP Analyzer and TCP/IP Optimizer.

For years, SpeedGuide.net lagged behind BroadbandReports.com. It seemed to remain focused primarily on dialup, even when cable, DSL, and other fast connections were becoming commonplace. After a while, I let the site fall off my radar.

But Wendell is right: Their current tools are up to date and very nice. What’s more, they’re even more automated than BroadbandReport’s. If you’re looking to get the most out of your online connections, Speedguide is back in business!

Thanks, Wendell!

Fred Langa edited the LangaList e-mail newsletter from 1997 to 2006, when it merged with Windows Secrets. Prior to that, he was editor of Byte Magazine and editorial director of CMP Media, overseeing Windows Magazine and others.
= Paid content

All Windows Secrets articles posted on 2007-04-05:

Fred Langa

About Fred Langa

Fred Langa is senior editor. His LangaList Newsletter merged with Windows Secrets on Nov. 16, 2006. Prior to that, Fred was editor of Byte Magazine (1987 to 1991) and editorial director of CMP Media (1991 to 1996), overseeing Windows Magazine and others.