Assign Sata Device to Qube

150 views
Skip to first unread message

Who Cares

unread,
Aug 25, 2018, 9:33:25 AM8/25/18
to qubes-users
Hi there,

I want to assign my HDD directly to a specific HVM Qube.
Its connected per Sata.
I already tried with "lspci" or "qvm-pci" but I never find my HDD.
With "qvm-block" I find it at dom0:sdb but how can I assign the complete HDD to a specific Qube even after restart like I can assign PCI devices in the Qubes Device Manager?

The Qube is an HVM which needs to access the HDD because I want to install a Linux based System(Kerio control) which cannot handle the Qubes-System that offers the Space on the System Drive. So I need to pass through a complete HDD that is supported by this System(Kerio-control) I want to install in the HVM.

Hopefully someone got a Solution :)

Thanks so far!

awokd

unread,
Aug 25, 2018, 10:54:48 AM8/25/18
to Who Cares, qubes-users
On Sat, August 25, 2018 1:33 pm, Who Cares wrote:
> Hi there,
>
>
> I want to assign my HDD directly to a specific HVM Qube.
> Its connected per Sata.
> I already tried with "lspci" or "qvm-pci" but I never find my HDD.
> With "qvm-block" I find it at dom0:sdb but how can I assign the complete
> HDD to a specific Qube even after restart like I can assign PCI devices
> in the Qubes Device Manager?

No native way to do it I know of, but you could maybe use dom0 scripts.
See https://github.com/QubesOS/qubes-issues/issues/3820 for some ideas.


Unman

unread,
Aug 25, 2018, 11:17:45 AM8/25/18
to Who Cares, qubes-users
In 3.2 you could just edit the conf file under /var/lib/qubes...

In 4.0:
Have a look at
https://dev.qubes-os.org/projects/core-admin/en/latest/libvirt.html

You want to add a new device: use normal Xen configuration.
https://libvirt.org/formatdomain.html#elementsDisks will help.
Use the phy driver, and specify the source as /dev/sdX, and target dev on your qube.

unman

Who Cares

unread,
Aug 25, 2018, 4:15:47 PM8/25/18
to qubes-users

I do not really know how to use this information there.
What should I work myself into first to understand this?

Unman

unread,
Aug 25, 2018, 10:04:35 PM8/25/18
to qubes-users
The libvirt page explains how to create a custom specification for a
qube, and where to put the files.
The basic specification is created from a template file - on my system
it's at /usr/share/qubes/templates/libvirt/xen.xml. (The documentation
is a little out of step here.)
If you look at that file you can see how the configuration for your
qubes is constructed.

What we want to do is to modify the settings for qube foo so that
/dev/sdb on dom0 will appear at /dev/xvde in foo.

Create a new file in dom0 at:
/etc/qubes/templates/libvirt/by-name/foo.xml

The contents are:
{% extends 'libvirt/xen/xml' %}
{% block devices %}
{{ super() }}
<disk type='block' device='disk' >
<driver name='phy' />
<source dev='/dev/sdb' />
<target dev='/dev/xvde' />
</disk>
{% endblock %}


The "extends" statement tells the system that it will be modifying the
definition in libvirt/xen.xml
The "super()" imports the specification for block devices from that file.
Then we define a new disk device - the syntax here is quite obvious and
follows the reference in libvirt.org

Now when you boot foo, Qubes will pick up this file, and attach /dev/sdb
to the foo qube, where it will appear as /dev/xvde.
You can put an entry in to /etc/fstab so that the /dev/xvde device will
be automatically mounted where you will.

hth

unman

Who Cares

unread,
Aug 27, 2018, 9:56:49 AM8/27/18
to qubes-users

I got a Question about that ....

Somehow I got no templates directory under /etc/qubes?

But I found the xen.xml.

And what does "by-name" mean?

Its just about where to put this file so that Qubes pick it up upon boot of foo.

unman

unread,
Aug 29, 2018, 9:15:16 AM8/29/18
to qubes-users
On Mon, Aug 27, 2018 at 06:56:48AM -0700, Who Cares wrote:
>
>
> I got a Question about that ....
>
> Somehow I got no templates directory under /etc/qubes?

You can just create the directory structure as needed.
>
> But I found the xen.xml.
>
> And what does "by-name" mean?

"by-name" is just a literal directory name.
You use it to identify configuration files by qube name.

> Its just about where to put this file so that Qubes pick it up upon boot of foo.
>

Yes

3mp...@gmail.com

unread,
Sep 5, 2018, 10:21:09 AM9/5/18
to qubes-users

Thanks Unman for your explanations ! There are just some small glitches in your syntax, here's the right content to put in <yourQubes>.xml file (xen.xml and not xen/xml and not specifying /dev/xvde but xvde):

{% extends 'libvirt/xen.xml' %}

{% block devices %}
{{ super() }}
<disk type='block' device='disk' >
<driver name='phy' />
<source dev='/dev/sdb' />

<target dev='xvde' />
</disk>
{% endblock %}

unman

unread,
Sep 5, 2018, 11:01:15 AM9/5/18
to qubes-users
Quite right. I misspoke.
Thanks for correction.
Reply all
Reply to author
Forward
0 new messages