1

This page says:

And, not all USB disks can be presented to a VM as a passthrough disk.

That is the important part.

If the driver is strictly user mode the USB disk cannot be presented. Only a select few devices presente themselves in a way that the system (outside the user session) can properly access and control the disk.

Suppose I wanted to use this functionality, but then needed a replacement for my USB disk. How would I tell before buying if it has this capability?

Note: I am assuming, from the context, that this is separate from the capability to "offline" the disk, which, AFAICT from posts elsewhere, is (thought to be) 1:1 tied to whether it's a spinning USB hard disk rather than a stick or other flash/SSD-ish beast. If this isn't correct, apparently I'd also need to know before buying whether a particular USB disk is offline-able.

Kev
  • 964
  • 4
  • 23
  • 46
  • A [workaround](http://www.gokhancanpolat.com/content/mount-usb-hyper-v-virtual-machine) that you can use with any USB disk. – Jason Mar 26 '15 at 16:41
  • @Jason, thanks, but I need to write to the USB drive, not just read a copy of it. – Kev Mar 26 '15 at 16:49
  • You can write to a VHD contained on a USB drive and mounted into a VM. So that workaround should work. – Brian Jun 19 '15 at 16:02
  • @Brian, then I need to maintain another VM, and the setup to get at the files in a disaster is more complicated. I just want the simpler setup of writing straight through to an ext4 drive from a Linux VM so I can take rsnapshot backups, and rotate offsite on a regular basis. I currently have this setup working, but only because I was lucky and the drives I bought happened to be compatible with this. I don't want someone in a pinch to get new drives to have to rely on luck... – Kev Jun 19 '15 at 18:49
  • 3
    To be a professional solution I recommend a USB - IP device in between, as it will allow any connection from any host to the USB device. If someday you got 2 hypervisor, if the vm is on #1, or #2, it's no longer a problem. As it's a virtual port it create, you will have less compatibility issue. – yagmoth555 Jun 22 '15 at 04:08
  • @yagmoth555 sounds interesting...do you use these with critical data? Do they tend to last? – Kev Jun 23 '15 at 10:36
  • @Kev It was more for usb key, but yes it was for crucial operation. As for me I used it to make a fax server with a usb modem. My customer had 5 host, thus that way the modem is always connected. One customer I know used a 12 port usb/tcpip box to plug in usb token for application licensing. (like acad use to got and such) A product example of what I mean; http://www.digi.com/products/usb/anywhereusb – yagmoth555 Jun 23 '15 at 14:55
  • @Kev: FYI, the capability to "offline" the disk, has **nothing** to do with whether it's a spinning USB hard disk rather than a stick or other flash/SSD-ish beast. The only thing it's 1:1 tied to is what sort of device the OS and controller driver presents as. In other words, a *controller* may present disks as removeable or not, but *all* disks of any type connected to that controller will *all* show as removeable regardless of what kind of disk it is. Certain SATA drivers will do this, others will not, same for USB. AFAIK though, the ability to 'offline' a disk is irrelevant and unnecessary. – noitsbecky Jun 24 '15 at 12:28
  • @qasdfdsaq thanks for your details, but the ability to offline is actually crucial for my application, which uses the disk as a pass-through to a VM. If you can't offline it, it is not available to pass through, because the VM demands full control over it in that scenario (you can't have the host OS messing with it.) – Kev Jun 24 '15 at 19:28
  • 1
    @Kev: I admit having not tried Hyper V, but using both VMware and Virtualbox under Windows, USB passthrough does *not* require a disk be offlined in Disk Management, nor is that a requisite for obtaining an exclusive lock an entire disk or partition in Windows. – noitsbecky Jun 25 '15 at 15:36
  • 1
    @qasdfdsaq +1, good to know about VMWare and Virtualbox, and Windows in general. HyperV does have this requirement though (see Step 1 of the link in the OP, plus I personally verified this the first time I ran through it.) Who knows why... – Kev Jun 25 '15 at 19:23

1 Answers1

1

There's no universal way to tell this before buying a drive as it is not a specification that anyone ever lists explicitly. However, the general rule, and reasoning is as follows:

All standard USB drives will be standard block devices. Any USB mass-storage (block) device should work for passthrough. The only exceptions are where USB drives have proprietary overlays or segmentation features. A non-exhaustive list of examples where this occurs is below. I'd posit >99% of non-encrypted drives will just work fine, the user-mode device presentation concern is a very, very unlikely issue to actually occur.

Some drives that uses a portable 'encryption' applications will be user-mode. In this case, an application loads a file or partition on the drive, decrypts it on-the-fly, and then presents a virtual volume to the OS. In other encrypted drives, the user mode application simply supplies an unlock/decryption key to the device, at which point the device hardware itself performs decryption and presents as a standard, unencrypted block device. In the second case, passthrough may work but may be unreliable, as the actual storage device doesn't usually show up until certain software is run that supplies the correct unlock code. Also, some drives will disconnect, and reconnect as a different device when unlocking is triggered.

Some drives that are larger than certain limits - e.g. LBA-32, MBR, SD(non-HC) etc. - most common in >2TB drives, will present as multiple, virtual 2TB drives. How they do this again varies as above, but can involve a software component. Devices that have a hardware switch to switch between two partitions tend to be OK.

Finally, some drives with funny features (particularly common in older gimmick drives and WiFi sticks or 3G modems), will present as multiple separate USB devices, sometimes connected to a hub. For example, some USB drives will present as a read-only CDROM, and a second USB block device. Some will only present as a USB CDROM with drivers on it, and once those drivers are installed, the CDROM disappears and a block device appears (or modem, etc.). Again, these are likely to work inconsistently with pass-through.

As a note, most drives that come with "one touch" backup software or similar, will be normal block drives, with the optional software just as a bunch of files in a folder in a normal filesystem - these can be used just fine, just ignore the extra software.

As a second note, from my earlier comment: the capability to "offline" the disk, has nothing to do with whether it's a spinning USB hard disk rather than a stick or other flash/SSD-ish beast

The only thing it's 1:1 tied to is what sort of device the OS and controller driver presents as. In other words, a controller may present disks as removeable or not, but all disks of any type connected to that controller will all show as removeable regardless of what kind of disk it is. Certain SATA drivers will do this, others will not, same for USB.

AFAIK though, the ability to 'offline' a disk isn't actually necessary.

noitsbecky
  • 606
  • 3
  • 13
  • Hmm, I was unaware about the >2TB aspect. That isn't an issue currently for us, but in the case that we were upgrading hardware for space reasons, it certainly could be. That's good to know. Do you have a link to more info about that? As an aside, would that also apply to yagmoth555's suggestion, to use a USB-to-IP setup (i.e. would the drive show up in multiple 2TB pieces; obviously in that case we would not be doing the 'offline'-able route anymore)? – Kev Jun 24 '15 at 19:32
  • @Kev: I'd say this is, again, something that's very rare and unlikely to affect you. I don't have a link I'm afraid, just know a few people on tech forums recently complaining about this still. USB-over-IP is literally that, so whatever the device shows up with on the host it'd show up as on the client - including multiple parts if that's how it was made by the manufacturer. – noitsbecky Jun 26 '15 at 15:38
  • Are these USB-over-IP devices scriptable? – Kev Jul 06 '15 at 11:52
  • @Kev: They're certainly scriptable under Linux, but I don't know about this environment. Perhaps worth asking a separate question? – noitsbecky Jul 06 '15 at 11:54
  • OK thanks, I'll have to look into it. So far the only ones I've seen officially support only Windows via a GUI util. – Kev Jul 06 '15 at 11:55