How To Simlink Entire Qubes Domain Without Breaking It?

Newbie Qubes user here… Just setting up my first Qubes system now, and want to know from the seasoned pros if this is possible…

I want to symlink an entire VM to an external drive.

The result I want is when I run the symlink script, all the read/writes to the VM are now read/written to/from the external hard drive, rather than the main drive.

The result I’m hoping for is creating a “ghost layer”… thats only visible if the external drive is attached, and symlinked.

I can imagine the script should look like this:

  1. Shut down the VM if running.
  2. Restart the VM.
  3. Attach the external drive to the VM
  4. Symlink the home folder.

Questions for the pros:

Will this work?
What unintended consequences might I face?
What top level VM directory do I need to symlink to get it to work?

Welcome aboard :wink:

There is a single “layering” level supported in Qubes: that’s the AppVM level atop a template. With

What you want looks like using a storage pool on external media. This use case is mentionned in the tech doc … though as an example of a driver that could be written above the storage API.

2 Likes

So from a layman’s perspective, going over that documentation:

I edit: storage.conf in Dom0. Something like this:

[ghost_layer]
driver=xen
dir_path=/opt/ghost

I create the vm using:

qvm-create ghost --label=black --pool:ghost_layer

(Unsure if I have the syntax of pool right?)

Then I create folder:

/Users/ghost/ghost_volume

Then on Dom0 have a script that symlinks to the new folder:

#!/bin/bash
ln -s /opt/ghost /Users/ghost/ghost_volume
qvm-start ghost

Before starting the vm ghost, if I run the script ^^^, then everything for that vm will be routed to the ghost_volume.
If I don’t run the script, then start vm ghost, everything is routed to the primary drive?

Now when starting the vm ghost, without the script there would be no hard drive footprints of activity done using the vm when symlinked to ghost_volume.

Correct?

Can you see any unintended consequences as a result of state differences between overt layer state of the ghost vm, and ghost layer state of the vm?

Is there anything I would need to add to make sure file permissions translated correctly to the symlink state ghost_volume?