Which Storage Devices Are Considered Removable?

AIR 2 has the ability to detect the mounting and un-mounting of storage volumes like flash drives, hard drives, some types of digital cameras, etc. (to see this in action, see A Demonstration of the New Storage Volume APIs in AIR 2). This feature basically piggybacks off of the operating system’s detection of storage devices. In other words, if the OS thinks something is a mass storage device, AIR will also recognize it as such and throw a StorageVolumeChangeEvent. If the OS does not recognize the device as a storage volume, AIR will not react to it. (Note: it is possible to detect and communicate with any type of peripheral in AIR 2 using external processes launched with the new NativeProcess API; the StorageVolume APIs are only for, well, storage volumes.)

The StorageVolumeChangeEvent which is thrown in response to a volume being mounted contains a reference to the StorageVolume object representing the volume that was just mounted. The StorageVolume object contains several interesting properties:

  • name
  • drive
  • fileSystemType
  • isRemovable
  • isWritable
  • rootDirectory

The isRemovable property indicates whether the operating system considers the media it just detected as removable or not. Initially, this seemed pretty straightforward to me, but as I began playing with the APIs, I found I didn’t always agree with the OS’s assessment. For instance, my portable 500GB Western Digital USB hard drive is not considered removable even though I plug it in and remove it all the time (note that this is the operating system’s decision — not AIR’s). And, for some reason, my Time Capsule is removable, but other network drives are not. Strange.

The table below shows the results of the testing I’ve done so far:

Type of Device StorageVolume.isRemovable
OS X Windows Linux
CD/DVD (fixed) true true true
USB Flash Drive true true true
USB Hard Drive false false true
FireWire Hard Drive false false true
Shared Volume true n/a1 n/a2
Network Drive false false n/a3
Storage Card Reader (empty) n/a4 false n/a3
Storage Card Reader (with SD/CF card) true true true

1 Windows treats shared volumes as network drives.

2 Linux doesn’t have a concept of a shared volume.

3 No StorageVolumeChangeEvent is thrown when drives are mounted using SMB on Linux.

4 Windows considers empty card readers to be non-removable devices while OS X and Linux do not react to them at all.

Update (12/10/09): Thanks for the feedback, both in the comments, and sent directly. Looks like we have all the information we need now. If you get any results that are inconsistent with what’s presented here, please let me know.

I’m hoping to get other developers to try out whatever devices they have lying around on whichever OS they favor so we can make this chart as comprehensive as possible. If you have the opportunity to provide data for any of the missing cells, or if you have devices that aren’t listed, please leave the information in the comments and I’ll update the table. Over time, this should become a very valuable resource for developers googling for answers.

If you need a quick way to test, I threw together this little utility called StorageVolumeTest.air (source code) which will report all the StorageVolume properties as volumes are detected and mounted. This app requires the AIR 2 public beta which can be downloaded here.

For more information on the new storage volume detection capabilities of AIR 2, see Exploring the new file capabilities in Adobe AIR 2. Thanks for your help!

3 Responses to Which Storage Devices Are Considered Removable?

  1. Here are some additional results:isRemovable on Linux (Ubuntu 9.04):CD/DVD (fixed): trueUSB Flash Drive: trueUSB Hard Drive: trueNetwork Drive: (using SMB nothing shows up in the AIR test app)CF Card Reader (no card): doesn’t show upCF Card Reader (card): trueI tested the CF reader on OS X 10.5.8:CF Card Reader (no card): doesn’t show upCF Card Reader (card): trueand on XP:CF Card Reader (no card): falseCF Card Reader (card): true

  2. Hello Christian,here are my results using your little app:isRemovable on OS X (10.6.2):Firewire 400 (using a simple external disk): falseFirewire 800 (using a Drobo): false

  3. Sagar says:

    Is there a way to detect usb device using as3 in flash cs4?
    Pls. let me know thanks!