• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Mounting and Dismounting (USB Drive) Volumes

 
Bill Denniston
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am writing a Java application to perform mass copying of files to many USB drive devices connected to a Windows PC via daisy chained USB hubs. The copy operation will be performed on as many USB drive devices as I can get to work simultaneously. (It looks like 127 ports per root on the PC, so at least this many simultaneous copy operations, performed repetitively over hundreds to thousands of USB drive devices in total.) While testing with a simple thumb drive on a Windows XP PC, inserting and removing the drive does not seem to require a formal "mount" and "dismount" action. However, Windows has a "Safely Remove Hardware" wizard, I presume for a reason (maybe not...) and I suspect performing this operation many times in a session as envisioned will cause problems with the OS. Can anyone comment on the need to formally mount or dismount large numbers of USB drive devices in a scenario like this? If mounting and dismounting is required, can you also please comment on the methods to use in Java, comparing alternatives if any. Many thanks for the help.
 
Rob Spoor
Sheriff
Pie
Posts: 20661
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bill Denniston wrote:However, Windows has a "Safely Remove Hardware" wizard, I presume for a reason (maybe not...)

Windows has two speed settings for external drives: optimized for performance and optimized for safe removal.

The latter is default for (most) new devices. It means that data that is written to the device directly. Removing the device without unmounting will cause no problems, but speed is limited. I've never got much more than about 5MB/s.

The former usually needs to be set manually through device manager. Data is written to a buffer inside Windows first; Windows will then gradually flush this buffer to the device. While the performance gain is significant (I got up to 25-30MB/s, a gain of over 400%) it does come at a cost. Removing the device without unmounting will cause any unflushed buffer contents to be discarded. It may even mess up the device's entire file system. Definitely not recommended.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic