I need to migrate a source VM with multiple virtual disks to Incus VM using incus-migrate.
The source VM has 4 vdisk images, and organised as LVM PV, VG and LV like this :
Allow incus-migrate to import a directory or disk image into a custom storage volume. This could then be attached to any instance you want.
Based on 1), have the instance migration logic have a menu option to add additional disks which would then import them as custom volumes and then attach them
Just as a side note (and I realise this is architectural and unlikely to change): I do find it limiting how Incus has separate concepts for the VM main disk and additional “storage” disks, and it’s not possible to use one as the other, or convert one to the other.
It means, for example, that I can’t shut down a VM, attach its primary disk to another VM, start that VM and perform maintenance on the original disk. Or I can’t run a script in a VM to build another VM in an attached storage disk.
The only way I know to do this is to boot from an ISO image, and then “incus exec” into the VM which is now running from ISO. But that means you’re either stuck with published ISOs (and have to install required packages each time you boot them); or you have to build your own bootable ISO.
A lot of internal logic depends on the fact that each instance has exactly one root disk at any one time and that it cannot be shared with any other instances. That’s unlikely to be something that will change in the near future due to how much internally depends on that.
That said, attaching an ISO image isn’t quite your only option. Something we’ve been doing for some customer migration projects has been having a full fledged VM disk as a custom volume, then attaching that to whatever VM we want to boot from it and set boot.priority=10 so it takes precedence over the local VM disk.
That allowed us to have a full stateful VM install that we could move from one VM to another as a temporary primary disk so we can go and inspect the VM’s root disk.
Thank you - that’s interesting, and probably easier to create than a custom ISO image.
Having said that, I’m not quite sure about the most direct way to create such a volume. I could create a regular VM from images:, and attach a storage volume of the same size. But then without booting it, is there a clean way to dd from the main volume to the storage volume?
In effect, what I want to do is to delete the VM, but convert its disk into a standalone storage volume.
Nothing particularly clean as of right now though the suggested improvement to incus-migrate above will make that much easier as you’ll be able to point incus-migrate at any disk image and load that as a custom volume that you can then attach to a VM.
For now I’d probably do the the dirty way by booting the VM with both disks and dd the data across. That should work fine and won’t require local root access.