qvm-block issues

64 views
Skip to first unread message

Drew White

unread,
Oct 31, 2016, 12:24:43 AM10/31/16
to qubes-users
Hi folks,

Well, I mounted an image to the guest.
Then I finished, so I unmounted it in the vm and went to remove it to attach it to another guest...

I tried several different methods...
================================================================
[{username}@dom0 {foldername}]$ qvm-block -d {vmname}:xvdi
Usage: qvm-block -l [options]
usage: qvm-block -a [options] <vm-name> <device-vm-name>:<device>
usage: qvm-block -A [options] <vm-name> <file-vm-name>:<file>
usage: qvm-block -d [options] <device-vm-name>:<device>
usage: qvm-block -d [options] <vm-name>
List/set VM block devices.

qvm-block: error: Invalid VM or device name: {vmname}:xvdi
[{username}@dom0 {foldername}]$ qvm-block -d {vmname}:/dev/xvdi
Usage: qvm-block -l [options]
usage: qvm-block -a [options] <vm-name> <device-vm-name>:<device>
usage: qvm-block -A [options] <vm-name> <file-vm-name>:<file>
usage: qvm-block -d [options] <device-vm-name>:<device>
usage: qvm-block -d [options] <vm-name>
List/set VM block devices.

qvm-block: error: Invalid VM or device name: {vmname}:/dev/xvdi
[{username}@dom0 {foldername}]$ qvm-block -d {vmname}:/dev/xvdi1
Usage: qvm-block -l [options]
usage: qvm-block -a [options] <vm-name> <device-vm-name>:<device>
usage: qvm-block -A [options] <vm-name> <file-vm-name>:<file>
usage: qvm-block -d [options] <device-vm-name>:<device>
usage: qvm-block -d [options] <vm-name>
List/set VM block devices.

qvm-block: error: Invalid VM or device name: {vmname}:/dev/xvdi1
[{username}@dom0 {foldername}]$ qvm-block -d {vmname}
[{username}@dom0 {foldername}]$
----------------------------------------------------------------
So, the only one that worked was " qvm-block -d {vmname} "

But that detaches everything. I only wanted to detach xvdi

To attach it I used....
================================================================
[{username}@dom0 {foldername}]$ qvm-block -A {vmname} dom0:/run/media/{username}/{partition_label}/{imagename}.img
----------------------------------------------------------------


I did this when it was saying that the device wasn't there, just to make 100% sure it was.
================================================================
[root@{vmname} {foldername}]# ls /dev/xv*
/dev/xvda /dev/xvdb /dev/xvdc /dev/xvdc1 /dev/xvdd /dev/xvdi /dev/xvdi1
[root@{vmname} {foldername}]#
----------------------------------------------------------------

What is it that has gone wrong here?

Alex

unread,
Oct 31, 2016, 2:58:34 AM10/31/16
to qubes...@googlegroups.com
On 10/31/2016 05:24 AM, Drew White wrote:
> Hi folks,
>
> Well, I mounted an image to the guest. Then I finished, so I
> unmounted it in the vm and went to remove it to attach it to another
> guest...
>
> I tried several different methods... [....]
> But that detaches everything. I only wanted to detach xvdi
>
> To attach it I used....
> ================================================================
> [{username}@dom0 {foldername}]$ qvm-block -A {vmname}
> dom0:/run/media/{username}/{partition_label}/{imagename}.img
> ----------------------------------------------------------------
>
Hi Drew,
afair qvm-block needs the name of the original VM where the device is
attached for removal. So, if you attached your device from dom0, you
will need to use dom0 for removal too. As an example, but using usbvm:

dom0$ qvm-block -a work usbvm:sdd
This attaches /dev/sdd in usbvm to work

dom0$ qvm-block -d usbvm:sdd
This now detaches /dev/sdd in usbvm from work

And this is why, in the --help output, the -d command has
<device-vm-name> instead of just <vm-name>, to highlight the fact that
you need the original vm name. If you want to detach everything you can
use the second syntax suggested by --help, using the vm name, and this
will detach everything from that vm.

I do know that you are mounting an image file; and I don't know if this
works this way too - i.e. if you need to specify the full path to the
file, like this:

dom0$ qvm-block -a work dom0:/mnt/foo/bar.img
and then
dom0$ qvm-block -d dom0:/mnt/foo/bar.img
to detach it

You can probably check the output of "qvm-block" without parameters,
once the image file is mounted; the first column of the output contains
the names used to identify the devices (or files, I suppose) to be managed.

Hope this helps,
--
Alex

Unman

unread,
Oct 31, 2016, 6:20:19 AM10/31/16
to Drew White, qubes-users
Hello Drew,

Check the man page -
what you want is this:
qvm-block -d <device-vm-name> -f <device>

You can just specify the device as xvdi, in your example.
That works for me with vanilla 3.2

This will leave other devices attached.

The help and man page are not that clear - why not submit a PR to help?

regards

unman

Drew White

unread,
Nov 3, 2016, 2:40:40 AM11/3/16
to qubes-users, alex...@gmx.com

but it says "<device-vm-name>" on the detatch, where the attach is "<file-vm-name>"... they are different...

So naturally, I assumed that fince it didn't say anything about "<file-vm-name>" that since I turned the file into a device on the guest, that the guest was the device-vm.

I merely looked at it the way that it said it's things.

But now I know better.

Thasnks.


Reply all
Reply to author
Forward
0 new messages