<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>jm2c &#187; VirtualBox</title>
	<atom:link href="http://frank.heydlauf.de/jm2c/archive/tag/virtualbox/feed" rel="self" type="application/rss+xml" />
	<link>http://frank.heydlauf.de/jm2c</link>
	<description>das musste mal gesagt werden</description>
	<lastBuildDate>Fri, 30 Apr 2010 18:05:51 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>VirtualBox on OS-X Host &#8211; howto mount an external USB drive</title>
		<link>http://frank.heydlauf.de/jm2c/archive/80/virtualbox-on-os-x-host-howto-mount-an-external-usb-drive</link>
		<comments>http://frank.heydlauf.de/jm2c/archive/80/virtualbox-on-os-x-host-howto-mount-an-external-usb-drive#comments</comments>
		<pubDate>Tue, 20 Oct 2009 06:34:38 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[OS-X]]></category>
		<category><![CDATA[Virtualisation]]></category>
		<category><![CDATA[grayed-out]]></category>
		<category><![CDATA[USB disk unavailable]]></category>
		<category><![CDATA[USB-disk]]></category>
		<category><![CDATA[VirtualBox]]></category>

		<guid isPermaLink="false">http://frank.heydlauf.de/jm2c/?p=80</guid>
		<description><![CDATA[Ever tried to connect an external USB-drive to your VirtualBox Guest and failed with the drive shown &#8220;unavailable&#8221; and grayed-out in the List of USB-devices? Well, that&#8217;s what happend to me &#8211; and I found a solution. You&#8217;re welcome to participate.
reworked 2009-11-25
Connect your USB drive physically
If you connect an USB-drive to your Mac, it shows [...]]]></description>
			<content:encoded><![CDATA[<p>Ever tried to connect an external USB-drive to your VirtualBox Guest and failed with the drive shown &#8220;unavailable&#8221; and grayed-out in the List of USB-devices? Well, that&#8217;s what happend to me &#8211; and I found a solution. You&#8217;re welcome to participate.</p>
<p>reworked 2009-11-25</p>
<div id="attachment_96" class="wp-caption alignnone" style="width: 465px"><img class="size-full wp-image-96" src="http://frank.heydlauf.de/jm2c/wp-content/uploads/2009/10/virtualbox-guest-usb-grayed-out2.png" alt="virtualbox-guest-usb-grayed-out" width="455" height="161" /><p class="wp-caption-text">VirtualBox Guest showing unavailable USB disk (Seagate FreeAgent)</p></div>
<h2>Connect your USB drive physically</h2>
<p>If you connect an USB-drive to your Mac, it shows up in the Finder &#8211; or in case of an unknown filesystem type (like ext3-fs) you&#8217;ll get a pop-up asking for action. In first case, &#8220;eject&#8221; the disk from Finder, in later case, select &#8220;<em>ignore</em>&#8220;.</p>
<p>The disk will in both cases still be known to OS-X:</p>
<pre>me$ diskutil list
...
/dev/disk1
 #:                      TYPE NAME      SIZE       IDENTIFIER
 0:     FDisk_partition_scheme          *931.5 Gi   disk1
 1:                      Linux           931.5 Gi   disk1s1</pre>
<h2>Essential things, nobody tells you (so far)</h2>
<p>This part took me quite some time to figure out. Reading the <a href="http://forum.virtualbox.org/" target="_blank">virtualbox-forum</a> I found the same problem occuring on Linux &#8211; but no hint about OS-X. With some experiments and good guessing, I found the following points being essential for a working setup:</p>
<ol>
<li>USB device filter</li>
<li>Manufacturer of the drive</li>
<li>permissions on host /dev/vboxdrv</li>
<li>kernel extensions on host</li>
</ol>
<h3>1. USB device filter &#8211; configuring VirtualBox</h3>
<p>This point has been essential for every setup I found working.</p>
<p>After starting VirtualBox.app, select the Virtual Machine in which you want to mount the USB-disk. Navigate to Details -&gt; USB -&gt; Ports -&gt; USB. Create a new filter for your USB-drive as shown below or an empty filter, matching every device (the naming of your disk may vary).</p>
<div>
<dl>
<dt><img src="http://frank.heydlauf.de/jm2c/wp-content/uploads/2009/10/virtualbox-usb-filter3.png" alt="virtualbox-usb-filter" width="514" height="389" /></dt>
<dd>Create device filter for USB disk </dd>
</dl>
</div>
<p>There may be a problem with just adding an USB device by klicking the &#8220;add&#8221;-icon and selecting the drive. Seems as if my Seagate FreeAgent does not match the automatically created filters. When I remove all settings but Name, Vendor ID and Product ID from the device filter, the drive gets available to the guest likewise using an any-filter. To be verified.</p>
<h3>2. Manufacturer of the drive</h3>
<p>Don&#8217;t laugh. The filter settings described above are sufficient for two of my USB drives and are not for two others (both Seagate).</p>
<p>If you have a look at the USB devices known to VirtualBox, and the disk still appears as &#8220;Unavailabe&#8221;, continue with the next steps.</p>
<pre> me$ VBoxManage list usbhost
 ...
 Manufacturer:       Seagate
 Product:            FreeAgent
 ...
 Current State:      <strong>Unavailable

</strong></pre>
<h3>3. permissions on host /dev/vboxdrv</h3>
<p><span style="color: #800000"><strong>WARNING! </strong></span>If you don&#8217;t understand what I am doing in this section &#8211; don&#8217;t try this at home. In any case it may be a good idea to have a backup before messing around with system settings.</p>
<p>Manipulating the permissions of /dev/vboxdrv worked for me with VirtualBox 3.0.8 &#8211; but stopped working after an OS-X update. You may want to continue with the next section.</p>
<p>First of all try starting VirtualBox.app as root and start the guest. If the USB drive is not longer unavailable/grayed-out, continue here.</p>
<p>Open a Terminal, become root (i.e. using <em>&#8217;sudo bash</em>&#8216;).</p>
<p>Have a look in the user-names, group-names and group-IDs on your system:</p>
<pre> dscl . -readall /Users UniqueID RealName
 dscl . -readall /Groups PrimaryGroupID RealName GroupMembership</pre>
<p>Create a new group, i.e. named <em>vboxusers</em> with group-ID <em>11104</em> (use a group-name and group-ID which is not used on your system!):</p>
<pre> dscl . create /Groups/<em>vboxusers</em>
 dscl . create /Groups/<em>vboxusers</em> name <em><em>vboxusers</em></em>
 dscl . create /Groups/<em>vboxusers</em> passwd "*"
 dscl . create /Groups/<em>vboxusers</em> gid <em>11104</em></pre>
<p>Add the user (i.e. &#8220;me&#8221;) who starts the Virtual Machine to the newly created group:</p>
<pre> dscl . merge /groups/<em>vboxusers</em> users "me"</pre>
<p>Usually a unix-group comes with a dedicated user. That should not be necessary but may help avoiding confusion with UIDs and GIDs</p>
<pre> dscl . create /Users/<em>vboxusers</em>
 dscl . create /Users/<em>vboxusers</em> UniqueID <em>11104</em>
 dscl . create /Users/<em>vboxusers</em> RealName "VirtualBox pseudouser"
 dscl . merge /Groups/<em>vboxusers</em> users "<em>vboxusers</em>"</pre>
<p>The essential step is to make the device file <em>vboxdrv</em> read- and writable for the users using the virtual machine. I do this by adding the user to the group <em>vboxusers</em> (see above) and allowing the group <em>vboxusers</em> to read/write the device file:</p>
<pre> chgrp <em>vboxusers</em> /dev/vboxdrv
 chmod g+rw /dev/vboxdrv</pre>
<p>Now logout and login to participate in the new group. Call &#8216;id&#8217; to verify:</p>
<pre>myhost:~ me$ id
uid=501(me) gid=501(me) groups=501(me),...,<strong>11104(vboxusers)</strong>,...</pre>
<h3>4. kernel extensions on host</h3>
<p>That&#8217;s the last trick in my bag. This is not deeply tested so far.</p>
<p>First step is to disconnect the USB drive then reboot your OS-X host.<br />
After rebooting, have a look at the loaded kernel extensions:</p>
<pre>me$ kextstat
Index Refs Address    Size       Wired      Name (Version) &lt;Linked Against&gt;
 1    1    0x0        0x0        0x0        com.apple.kernel (9.8.0)
 ...</pre>
<p>save the result.</p>
<p>Connect your usb drive and repeat the kextstat.<br />
Compare the old output with the new (diff is your friend).</p>
<p>You&#8217;ll probably find a new kernel extension loaded. Im my case this is:</p>
<pre>com.apple.iokit.IOUSBMassStorageClass (2.0.8)</pre>
<p>The trick is to unload this kernel extension:</p>
<pre>kextunload -b com.apple.iokit.IOUSBMassStorageClass</pre>
<p>Now you should be prepared&#8230;</p>
<h2>Start your engines&#8230;</h2>
<p>(Re-)Start VirtualBox.app, start the Virtual Machine you created the filter for. With everything done right, the USB-disk should show up immediately.  The view from host side:</p>
<pre> me$ VBoxManage list usbhost
 ...
 Manufacturer:       Seagate
 Product:            FreeAgent
 ...
 Current State:      <strong>Captured

</strong></pre>
<p>Using Linux, Debian Etch as guest:</p>
<pre> me@etch-test:/dev$ find /dev/disk
 ...
 /dev/disk/by-label/<strong>FreeAgent_Drive</strong>
 ...
 /dev/disk/by-id/<strong>usb-Seagate_FreeAgent_2XXXXXXX-part1</strong>
 /dev/disk/by-id/<strong>usb-Seagate_FreeAgent_2XXXXXXX

</strong></pre>
<h2>Updates</h2>
<p>2009-10-21: unfortunately the device files /dev/vbox* are created dynamicaly while booting the host system whereby the new permissions get lost.</p>
<p>2009-10-25: Even worse, after an OS-X system update, setting the permissions as described above, does not help any longer :-((</p>
<p>2009-11-05: Good news!! (Re)Installed the guest-additions for 3.0.10 &#8211; et voilà &#8211; it works again :-)). Don&#8217;t ask. I can&#8217;t see any relation to the OS-X update &#8211; and I&#8217;m not sure if it tomorrow will still be working.</p>
<p>Important points today are:</p>
<ul>
<li> Start the Virtual Mashine <em>before</em> plugging in the USB-Drive. If the Drive is connected while the VM is not running, it is taken by OS-X and I found no way to release it (shows up as &#8220;Unavailable&#8221; in &#8216;VBoxManage list usbhost&#8217;)</li>
<li>At the moment only an &#8220;any&#8221; filter catches the USB-Drive.</li>
</ul>
<p>2009-11-25: After a bunch of tests, the focus rests at OS-X. If OS-X does not release the drive, Virtualbox could not access ist. So unloading the OS-X USB driver seems to be the way to go. Matching USB device filters assumed. Rework of this article.</p>
<p>2010-03-07: Sun confirmed an error in 3.1.4 about two weeks ago:  <a title="http://forums.virtualbox.org/viewtopic.php?f=8&amp;t=23701&amp;start=15" href="http://forums.virtualbox.org/viewtopic.php?f=8&amp;t=23701&amp;start=15">http://forums.virtualbox.org/viewtopic.php?f=8&amp;t=23701&amp;start=15</a></p>
<p><span> </span></p>
<div>
<blockquote>
<h3><a href="http://forums.virtualbox.org/viewtopic.php?f=8&amp;t=23701&amp;start=15#p126470">Re: USB Devices unavailable/grayed-out due to permission problem</a></h3>
<p><a href="http://forums.virtualbox.org/viewtopic.php?p=126470#p126470"><img src="http://forums.virtualbox.org/styles/prosilver/imageset/icon_post_target.gif" alt="Post" width="11" height="9" /></a>by <strong><a href="http://forums.virtualbox.org/memberlist.php?mode=viewprofile&amp;u=10857">Ramshankar</a></strong> » 26. Feb 2010, 22:51</p>
<div>The non-capturing of USB devices using filters is a 3.1.4 regression (3.1.2 works fine) and will be resolved in the next release. Thank you all for reporting and sorry for the inconvenience, it was the side effect of a much larger change that went unnoticed.</div>
<div>Sun Microsystems GmbH</div>
<div></div>
</blockquote>
</div>
<h2>Additional notes:</h2>
<ul>
<li>This HOWTO is based on Mac OS X 10.5.8 as host with Sun VirtualBox 3.0.8 r53138 and 3.0.10 r54097.</li>
<li>Using an USB-stick, the guest-USB entry will <em>not</em> be grayed-out. The permission problem appears (at least on my Macbook) only with USB-drives.</li>
<li>Without a) the device filter mentioned above <em>and</em> b) the correct permissions, the USB device will show up grayed-out in the guest.</li>
<li>If you don&#8217;t want to use dscl to edit the user/group settings, try OS-X &#8220;server admin tools&#8221;, currently located <a title="Apple OS X Server Admin Tools Download-Link" href="http://www.apple.com/downloads/macosx/apple/application_updates/serveradmintools1057.html" target="_blank">http://www.apple.com/downloads/macosx/apple/application_updates/serveradmintools1057.html</a> (URL changes with every update).</li>
<li>Unhappily VirtualBox still seems to have problems in managing the usb devices. During my experiments, the USB devices regularly disappeared completely from all settings-menues.  Other strange things happened which I can not reproduce. Restart of VirtualBox helped in these cases.</li>
<li>This topic is related to <a title="VirtualBox Forum Artikel 23701" href="http://forums.virtualbox.org/viewtopic.php?f=8&amp;t=23701" target="_blank">http://forums.virtualbox.org/viewtopic.php?t=23701</a> and <a href="http://www.virtualbox.org/ticket/4168#comment:9">http://www.virtualbox.org/ticket/4168</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://frank.heydlauf.de/jm2c/archive/80/virtualbox-on-os-x-host-howto-mount-an-external-usb-drive/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
