Incus-migrate rename zfs dataset instead of rsync

Hello,

I’m trying to migrate all my QEMU VMs to incus. I managed to do it but I read in the documentation that it uses rsync to transfer the volume.

Would it be possible to speed up the process by performing a zfs rename from my dataset to the target dataset? Or is this not technically possible?

Thanks in advance,

Summary
root@srv-home:~ # ./incus-migrate                                                                                                                                                                                    
The local Incus server is the target [default=yes]:                                                                                                                                                                  
Would you like to create a container (1) or virtual-machine (2)?: 2                                                                                                                                                  
Name of the new instance: buster                                                                                                                                                                                     
Please provide the path to a disk, partition, or qcow2/raw/vmdk image file: /dev/zvol/rpool/VM/buster/root                                                                                                           
Does the VM support UEFI booting? [default=yes]: no                                                                                                                                                                  
                                                                                                                                                                                                                     
Instance to be created:                                                                                                                                                                                              
  Name: buster                                                                                                                                                                                                       
  Project: default                                                                                                                                                                                                   
  Type: virtual-machine                                                                                                                                                                                              
  Source: /dev/zvol/rpool/VM/buster/root                                                                                                                                                                             
  Source format: Block device                                                                                                                                                                                        
  Config:                                                                                                                                                                                                            
    security.csm: "true"                                                                                                                                                                                             
    security.secureboot: "false"                                                                                                                                                                                     
                                                                                                                                                                                                                     
Additional overrides can be applied at this stage:                                                                                                                                                                   
1) Begin the migration with the above configuration                                                                                                                                                                  
2) Override profile list                                                                                                                                                                                             
3) Set additional configuration options                                                                                                                                                                              
4) Change instance storage pool or volume size                                                                                                                                                                       
5) Change instance network                                                                                                                                                                                           
                                                                                                                                                                                                                     
Please pick one of the options above [default=1]: 4                                                                                                                                                                  
Please provide the storage pool to use: default                                                                                                                                                                      
Do you want to change the storage size? [default=no]: yes                                                                                                                                                            
Please specify the storage size: 8GiB                                                                                                                                                                                
                                                                                                                                                                                                                     
Instance to be created:                                                                                                                                                                                              
  Name: buster                                                                                                                                                                                                       
  Project: default                                                                                                                                                                                                   
  Type: virtual-machine                                                                                                                                                                                              
  Source: /dev/zvol/rpool/VM/buster/root                                                                                                                                                                             
  Source format: Block device                                                                                                                                                                                        
  Storage pool: default                                                                                                                                                                                              
  Storage pool size: 8GiB
  Config:
    security.csm: "true"
    security.secureboot: "false"

Additional overrides can be applied at this stage:
1) Begin the migration with the above configuration
2) Override profile list
3) Set additional configuration options
4) Change instance storage pool or volume size
5) Change instance network

Please pick one of the options above [default=1]: 
Transferring instance: buster: 3.31GB (27.54MB/s)   
Instance buster successfully created       

You could run incus create --empty --vm and then substitute the ZFS volume.

1 Like

Thanks I’ll try this but I’m stuck on another problem.

All my VMs have a separate /boot (/dev/zvol/rpool/VM/buster/boot) device would you have an idea to move it with as I don’t see anything in incus-migrate.

Or maybe I should recreate my /boot before migrating?

I’ve tried to rsync my boot volume to my root (in /boot) before migrating the VM but I can’t get the VM to boot:
(Also remove entry into /etc/fstab)

root@srv-home:~ # incus create buster --empty --vm --device root,size=70GiB --profile default --profile eth0 --profile cpu-4-cores --profile mem-4GiB
root@srv-home:~ # incus profile remove buster default
root@srv-home:~ # zfs rename rpool/lxd/virtual-machines/buster.block rpool/lxd/virtual-machines/buster.block.old                                                                                                   
root@srv-home:~ # zfs snapshot -r rpool/VM/buster/root@migrate_to_incus                                                                                                                                             
root@srv-home:~ # zfs clone rpool/VM/buster/root@migrate_to_incus rpool/lxd/virtual-machines/buster.block                                                                                                          
root@srv-home:~ # incus start buster
root@srv-home:~ # incus console --show-log buster
SeaBIOS (version rel-1.16.3-0-ga6ed6b7)
Machine UUID 25a7aed7-e235-4fd8-8dab-4a8ce9762796


iPXE (http://ipxe.org) 05:00.0 CA00 PCI2.10 PnP PMM+7EFD3100+7EF33100 CA00
                                                     


Booting from Hard Disk...
incus config show --expanded buster
root@srv-home:~ # incus config show --expanded buster
architecture: x86_64
config:
  limits.cpu: "4"
  limits.memory: 4GiB
  security.csm: "true"
  security.secureboot: "false"
  volatile.cloud-init.instance-id: 55877507-3fd6-4b3e-a33f-65a870d9c517
  volatile.eth0.hwaddr: 10:66:6a:8e:c7:31
  volatile.last_state.power: STOPPED
  volatile.last_state.ready: "false"
  volatile.uuid: 25a7aed7-e235-4fd8-8dab-4a8ce9762796
  volatile.uuid.generation: 25a7aed7-e235-4fd8-8dab-4a8ce9762796
  volatile.vm.definition: pc-q35-9.0
  volatile.vsock_id: "1173708812"
devices:
  eth0:
    name: eth0
    nictype: bridged
    parent: br0
    type: nic
  root:
    path: /
    pool: default
    size: 70GiB
    type: disk
ephemeral: false
profiles:
- eth0
- cpu-4-cores
- mem-4GiB
stateful: false
description: ""

I’ve checked and there’s no UEFI.

Am I missing something?

Your boot device is probably where grub was installed, so if moving the content of that partition to /boot in the root disk, you’ll need to also run grub-install so that the MBR of the root disk contains grub.

1 Like