Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm taking a college course where we are using VMs to safely work with the Linux kernel, and as such, we've been told that it would be useful to have our VM stored on a flash drive (if we want to work on campus.)

I bought a usb 3.0 flash drive (Corsair Voyager GT 32gb) and have been working painfully slowly at some points, particularly updating (using 'sudo yum update' took 3 - 6hours). This was after making sure to enable the Virtualization in UEFI, which sped things up immensely. I cloned the VM so that I could finish the first project on my SSD (in hopes that it would be faster) and I made sure that the clone is set to recognize it is an SSD, however I noticed another setting for the Controller: SATA section called use host I/O cache.

Should I enable this setting for either my SSD's clone of the VM or my flash drive's VM? Will it make any difference to the performance or speed anything up?

share|improve this question
up vote 2 down vote accepted

Your VirtualBox .vdi file is "just a file" as far as the host operating system (I'm assuming Windows, here) is concerned. Don't know how much you've learned about operating systems so far, but if you are familiar with the concept of virtual memory and how on-disk files are paged into memory, this is basically saying:

  • If you disable host I/O cache, then when the guest does page reads/writes, if it page faults in the guest (the guest doesn't have the page in memory), the page fault will always page fault the host, which hits the storage media with a physical read or write.
  • If you enable host I/O cache, then the host will cache pages of the VDI file. Then, when the hypervisor requests these pages from the host operating system, they may not always page fault, if the pages are already in RAM when being read / written.

Writing is a bit more complicated, because it depends on whether your caching strategy is writeback/writethrough, and whether your guest and host filesystems do write combining, delayed allocation, journal/metadata delayed allocation, and so on.

To put it in layman's terms: using the host I/O cache will improve performance, possibly at the detriment of data safety, depending on the design of the host filesystem and its caching strategy. The performance gain is directly related to the amount of "free" RAM on the host (the amount of RAM that is not being used for pages of data resident in an application's virtual address space, or the kernel's address space). More RAM = more performance. This is because, without host I/O caching, the amount of RAM you can use to avoid page faults is limited to the amount of RAM allocated to the guest -- the guest's filesystem / virtual memory manager will do as much avoidance of page faults as possible, but the guest always has less allocated memory than the sum of the guest's memory and the host's memory. When you enable host I/O cache, you get the rest of the host memory too.

Just make sure that, if your USB device is configured for high performance and low data safety (it's an option in the device manager), that you don't "yank" the drive without gracefully telling Windows to remove the drive using the system tray. If it's configured for "quick removal", then that will greatly reduce performance, but you'll be able to safely remove it at any time with almost no loss of data. But always shut down your VM before removing the flash drive.

Another thing: Flash drives are much, much slower than SSDs, as you probably know. The reason is that they are designed cheaply with a single cell, whereas SSDs are basically "lots of flash drives put together" (for higher performance). You get what you pay for. Flash drive performance is always going to be unacceptably slow compared to the performance of a hard drive or SSD, regardless of what connector you use.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .