Access Dom0 Partitions inside a User Qube


I installed qubes in the root partition in disk 1, which contains additional partitions.
These partitions I can access with the Thunar File manager from dom0 and i am able to access the second disk with its own partition as well. Owner of all partitions is root. So far so good.

I installed a template DEBIAN12 and based on this template a Qube called Office successfully.
Now i want to access the - additional - partitions from the dom0 environment inside the user Qube Office, and the big partition, because i store my media files (picture, music, video) in the second drive.

How I do have to configure the system ??

I really appreciate your detailed answer in advance.

regards, hitam


thank you for your reference. qvm-block ONLY lists the partitions of an USB stick, but NOT the partitions of the fixed disks.

regards, hitam

In dom0 terminal:

sudo losetup -f --show /dev/sda

Change /dev/sda to your disk name.

Ok, thanks . I received a list of all partitions on both disks including their loop devices.

I could attach one partition to the Office qube, but it does not show up in the file manager of the Office qube. Why ?

regards, Hitam

qvm-block a Office dom0:loop36
error: backend on ‘dom0’ does not expose ‘loop36’

Output from qvm-block:


dom0:loop38 /dev/sda1 Office(read-only=no, frontend-dev=xvdi)

The partition is not visible in Office !!! !!!

in fstab in der Office VM

I found the entry:

/dev/xvd1 /mnt/removabe auto noauto,user, rw 0 0

The directory /mnt/removable does not exist !

i added the directory manually, a sudo mount -a did not change the situation.
after a rebbot of Office qube, the directory disappeared.
reagrds, hitam

What’s the output of this command in Office qube?

sudo fdisk -l

Do you see /dev/xvdi device there?

Follow the linked doc:

cd ~
mkdir mnt
sudo mount /dev/xvdi2 mnt

Then access the /home/user/mnt directory in your File Manager.

Yes, xvdi device is present in Office.

Thanks a lot everything is Ok, i can see and access the share will put it in fstab as well.

regards, hitam

After restart of the Office qube all hand made changes are LOST !
Even the fstab has been changed to the old content !

Do i have to do it always manually ???

Why fstab destroys manually added mounts after each reboot ???

sudo mount /dev/xvdi /home//user/mnt ???

Another problem is, that user cannot make any changes to the mount (owner is still root)

You can change files ownership from root to user if you want:

sudo chown -R user:user /home/user//mnt

Thank you very much for your kind support and help to get started with Qubes in an efficient way.The next step i want to automate attaching the partitions to the Office Qube by executing a script, which should be run every time dom0 will be started. Where i do have to place such a script to automatically executed by dom0???

reagrds, hitam

You can attach the block devices to a qube persistently by using qvm-block command line tool in dom0 terminal, there is a --persistent flag:

[user@dom0 ~]$ qvm-block -h
usage: qvm-block [--verbose] [--quiet] [--help] [--list-device-classes] {list,ls,l,attach,at,a,detach,d,dt} ...

Qubes volume and block device managment

  --verbose, -v         increase verbosity
  --quiet, -q           decrease verbosity
  --help, -h            show this help message and exit

  For more information see qvm-device command -h

    list (ls,l)         list devices
    attach (at,a)       Attach device to domain
    detach (d,dt)       Detach device from domain

Command 'list':
  usage: qvm-block list [--verbose] [--quiet] [--help] [--all] [--exclude EXCLUDE] [VMNAME ...]

Command 'attach':
  usage: qvm-block attach [--verbose] [--quiet] [--help] [--option OPTION] [--ro] [--persistent] VMNAME BACKEND:DEVICE_ID

Command 'detach':
  usage: qvm-block detach [--verbose] [--quiet] [--help] VMNAME [BACKEND:DEVICE_ID]

thank you very much for your advice. :slightly_smiling_face:

I tried to attach the partition to the qube office with this command:

qvm-block at --persistent Office dom0:/dev/loop8
qvm-block: error backend ‘dom0’ doesn’t expose ‘/dev/loop8’

The device loop8 is available in dom0.

What happened ?

Run this command to see the correct device id:

qvm-block list

I guess it should be like this:

qvm-block at --persistent Office dom0:loop8

But on second thought, you’ll still need to run losetup command to expose your block devices so you’ll still have to run this command on Qubes OS start.
You can use specific loop device number so it’ll be consistent and you can use --persistent flag with it:

sudo losetup loop987 /dev/sda

You can use cron/systemd service/something else to run your script on startup:

Ok, that worked for me.

The fstab in the qube Office shows:

/dev/xvdi /mnt/removable auto noauto,user, rw 0 0

with the directory removable is non existing.

If i change with sudo the fstab into

/dev/xvdi /home/user/mnt auto noauto, user, rw 0 0

and save the file

the changes will be lost after the next restart and I have to do it allover again.

Why ???

How to make my changes in /etc/fstab persistent ???

regards, hitam

Read the link that I posted before:

You need to edit the fstab in template of your Office qube or maybe you can try to use bind-dirs in Office qube: