Still possible to mount vm private image?

In this 2017 blog post, Joanna suggested the possibility of mounting a VM’s disk image in another VM, to avoid booting it. She suggested these commands:

[joanna@dom0 ~]$ qvm-block -A --ro admin-ir dom0:/var/lib/qubes/appvms/personal/private.img
[root@admin-ir user]# mount -o ro /dev/xvdi /mnt/personal/

I believe the format for the first command is obsolete. It should be, I think, qvm-block attach... instead of qvm-block -A.... But also the private.img no longer lives at this path and you will get an error passing a path like that as the deviceid.

I’ve been unable to find the new location of the private.img. Is it still possible to mount a VM’s disk without booting the VM, similar to the above?

(My original use case for this was a VM that had a startup script I wished to avoid running. I found a workaround in that case. Today I wanted this as a convenience mechanism; I have a file in an old sys-net I want to copy out (very simple wifi restart script) and it will not boot if another sys-net is going.)

Sorry, again me, this time not interested in, haha. Did you mean on /dev/qubes_dom0/?

1 Like
[user@dom0 ~]$ sudo losetup -f /dev/qubes_dom0/vm-sys-net-private
[user@dom0 ~]$ qvm-block attach --ro admin-ir dom0:loop1
[user@admin-ir ~]$ mount -o ro /dev/xvdi

Does this work for you?

1 Like

Thanks enmus. Had to break for a bit, sorry for delay.

The second command in your sequence results in the error “backend vm ‘dom0’ doesn’t expose device ‘loop1’”. Even though first command worked fine.

The first (losetup) command results in alert “Device /dev/dm-107 is available” so I tried instead of loop1 to attach this device id using qvm-block attach… but this results in the “doesn’t expose device…” error (I tried with both /dev/dm-107 and just dm-107).

Maybe your device is loop0? Or any other number?

If not, and since it works flawlessly with me, the only thing I can suggest is
https://groups.google.com/g/qubes-users/c/LLSo_3oWXJI

1 Like

OK, this worked, setting the loop device id explicitly (and this is mounting sys-net1 inside sys-net):


sudo losetup loop42 /dev/qubes_dom0/vm-sys-net1-private

sudo qvm-device block attach --ro sys-net dom0:loop42

I did not need to mount in sys-net as /dev/xvdi was already at /mnt/removable. I’m on 4.1, which perhaps already had some sort of loop1 mounted (?).

Thanks for the assistance! :pray:

You’re welcome. Please consider to mark any post as a solution so it could help other users too.