Attaching dom0 external USB HD to domU

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Attaching dom0 external USB HD to domU

John Naggets
Hi,

I have an external USB 3.0 hard disk connected to my dom0 physical
server. Now I would like the whole disk to be available in a specific
domU. My conclusion is that there are 3 possible ways to configure
that with the xl.cfg file of the domU: using usb, using pci
passthrough and using the disk.

The easiest of all 3 seems to be to simply add an extra entry in the
disk [] parameter such as:

'phy:/dev/sdf,xvdb,w',

/dev/sdf is the device name of my USB external storage on the dom0 and
would be available as xvdb on my domU.

Would this work? or is it not recommended and I should rather use the
usb config for that purpose?

Regards,
J.

_______________________________________________
Xen-users mailing list
[hidden email]
https://lists.xenproject.org/mailman/listinfo/xen-users
Reply | Threaded
Open this post in threaded view
|

Re: Attaching dom0 external USB HD to domU

George Dunlap
On Sun, Mar 18, 2018 at 11:48 AM, John Naggets <[hidden email]> wrote:

> Hi,
>
> I have an external USB 3.0 hard disk connected to my dom0 physical
> server. Now I would like the whole disk to be available in a specific
> domU. My conclusion is that there are 3 possible ways to configure
> that with the xl.cfg file of the domU: using usb, using pci
> passthrough and using the disk.
>
> The easiest of all 3 seems to be to simply add an extra entry in the
> disk [] parameter such as:
>
> 'phy:/dev/sdf,xvdb,w',
>
> /dev/sdf is the device name of my USB external storage on the dom0 and
> would be available as xvdb on my domU.
>
> Would this work? or is it not recommended and I should rather use the
> usb config for that purpose?

It should work, with the following caveats:

1. Your guest OS won't know that it's a removable device, and so may
not be as aggressive about flushing data out to it to avoid data loss
in the case of unexpected force removal.
2. The device name (/dev/sdf) may not be stable: that is, every time
you remove or insert the device, or every time you reboot, you might
get a different device name, so you'll need to change the config file.
(Or alternately, create a custom udev rule that would recognize that
particular USB device and give it a consistent name.)

If you're using an HVM guest, and have a new enough version of Xen to
have the 'usbdevice' directive, you can use the "bus.addr" naming
scheme, which should (I believe) be consistent across both device
removal and across reboots (as long as you always plug it into the
same slot); but that does mean restricting your guest type, as well as
emulating a USB controller and so on, which could potentially be less
efficient.

Hope that helps. :-)

 -George

_______________________________________________
Xen-users mailing list
[hidden email]
https://lists.xenproject.org/mailman/listinfo/xen-users
Reply | Threaded
Open this post in threaded view
|

Re: Attaching dom0 external USB HD to domU

John Naggets
On Tue, Mar 20, 2018 at 12:27 PM, George Dunlap <[hidden email]> wrote:

> It should work, with the following caveats:
>
> 1. Your guest OS won't know that it's a removable device, and so may
> not be as aggressive about flushing data out to it to avoid data loss
> in the case of unexpected force removal.
> 2. The device name (/dev/sdf) may not be stable: that is, every time
> you remove or insert the device, or every time you reboot, you might
> get a different device name, so you'll need to change the config file.
> (Or alternately, create a custom udev rule that would recognize that
> particular USB device and give it a consistent name.)

Thanks George for confirming and for your tips regarding that setup.

> If you're using an HVM guest, and have a new enough version of Xen to
> have the 'usbdevice' directive, you can use the "bus.addr" naming
> scheme, which should (I believe) be consistent across both device
> removal and across reboots (as long as you always plug it into the
> same slot); but that does mean restricting your guest type, as well as
> emulating a USB controller and so on, which could potentially be less
> efficient.

This is actually the case, I am using HVM for a Win2k12r2 domU. So do
I understand you correctly that the only thing I need in my domU cfg
file is the following:

usb=1
usbdevice=[ "host:1.4" ]

In that case let's say lsusb showed my external USB disk plugged in on
bus 001 and device 004.

By the way I am using Xen 4.9 on Ubuntu 17.10.

Best,
J.

_______________________________________________
Xen-users mailing list
[hidden email]
https://lists.xenproject.org/mailman/listinfo/xen-users
Reply | Threaded
Open this post in threaded view
|

Re: Attaching dom0 external USB HD to domU

George Dunlap
On Wed, Mar 21, 2018 at 3:01 PM, John Naggets <[hidden email]> wrote:

> On Tue, Mar 20, 2018 at 12:27 PM, George Dunlap <[hidden email]> wrote:
>> It should work, with the following caveats:
>>
>> 1. Your guest OS won't know that it's a removable device, and so may
>> not be as aggressive about flushing data out to it to avoid data loss
>> in the case of unexpected force removal.
>> 2. The device name (/dev/sdf) may not be stable: that is, every time
>> you remove or insert the device, or every time you reboot, you might
>> get a different device name, so you'll need to change the config file.
>> (Or alternately, create a custom udev rule that would recognize that
>> particular USB device and give it a consistent name.)
>
> Thanks George for confirming and for your tips regarding that setup.
>
>> If you're using an HVM guest, and have a new enough version of Xen to
>> have the 'usbdevice' directive, you can use the "bus.addr" naming
>> scheme, which should (I believe) be consistent across both device
>> removal and across reboots (as long as you always plug it into the
>> same slot); but that does mean restricting your guest type, as well as
>> emulating a USB controller and so on, which could potentially be less
>> efficient.
>
> This is actually the case, I am using HVM for a Win2k12r2 domU. So do
> I understand you correctly that the only thing I need in my domU cfg
> file is the following:
>
> usb=1
> usbdevice=[ "host:1.4" ]
>
> In that case let's say lsusb showed my external USB disk plugged in on
> bus 001 and device 004.
>
> By the way I am using Xen 4.9 on Ubuntu 17.10.

Yes, that's the right format.

But you know, I think I may be remembering incorrectly -- I think the
"bus.dev" number increments each time you plug and unplug it.  We
*wanted* to have an interface that allowed you to specify the exact
place in the topology but I think we never got around to it. :-/

Probably the easiest way to check would be to lspci, remove &
re-insert the device, and lspci again.

 -George

_______________________________________________
Xen-users mailing list
[hidden email]
https://lists.xenproject.org/mailman/listinfo/xen-users