Override root device for VMs?

Is it possible to override the root device to be a physical (i.e. nvme) device ?
I tried

lxc config device override testvm root source=/dev/nvme0n1

but I get

Error: Invalid devices: Device validation failed for "root": Root disk entry may not have a "source" property set

That is correct, the root device for all instances must come from one of LXD’s storage pools.

What are you trying to do here exactly? Create a VM which boots from a physical disk?

If so, you’d want something like this:

  • lxc init --empty --vm foo
  • lxc config device add foo my-nvme disk source=/dev/nvme0n1 boot.priority=10
  • lxc start foo --console=vga

That will still allocate a root disk from the storage pool, but simply not use it, instead adding the nvme as a secondary disk with the top boot priority so the VM boots from it.

1 Like



but that leaves a dangling 10G disk on the VM

I just need to run this single (windows) VM and all my pools are btrfs and that’s no good for VMs so I figured a single VM on its own nvme drive would do fine but …
So I guess I’ll have to create a seperate pool with the dir driver and have the VM/VM(s) run off that pool yeah?

yeah, you can do that. The 10GB dangling disk isn’t necessarily a huge issue though.
You could make it much smaller too with: lxc init --empty --vm foo -d root,size=1MiB

Is the root device really necessary at all?
I mean if there’s no deep dependency on it perhaps it would make sense to allow dropping it or at least defining a source for it?

It’s pretty deeply integrated in LXD that all instances get a root disk.
LXD assumes one exists for a lot of operations, from resizes, to migrations, to exports (backups), snapshots, …

1 Like

@stgraber roger that