[TUTORIAL] how to change the VMID with ZFS

maxprox

Renowned Member
Aug 23, 2011
423
60
93
Germany - Nordhessen
fair-comp.de
HI,
I found no solution to this, so I made one myself ;-)

EDIT on 2019-07-13:

Code:
##shutdown the VM
qm shutdown 106

## edit the VMID in the storage line[for me from local-zfs:vm-106-disk-0 to local-zfs:vm-104-disk-0]:
vim /etc/pve/nodes/name/qemu-server/106.conf

## rename the conf file:
mv /etc/pve/nodes/name/qemu-server/106.conf  /etc/pve/nodes/name/qemu-server/104.conf

## list the ZFS  volume or all:
zfs list -t all
...
rpool/data/vm-106-disk-0               1,11G  7,02T     1,10G  -
...

## rename it with zfs rename:
zfs rename rpool/data/vm-106-disk-0 rpool/data/vm-104-disk-0

## host restart is not needed
qm start 104
regards,
maxprox
 
Last edited:
You made some mistakes.

If you want to change VM ID you need.

1. Turn off VM.
2. Rename VM config file.
3. Change VM disks location ( in ZFS rename )
4. Change config disk location inside VM config file.
5. Start VM

p.s. why a lot of people do server restart? Do you use windows or what?
 
Last edited by a moderator:
You made some mistakes.

If you want to change VM ID you need.

1. Turn off VM.
2. Rename VM config file.
3. Change VM disks location ( in ZFS rename )
4. Change config disk location inside VM config file.
5. Start VM

p.s. why a lot of people do server restart? Do you use windows or what?

Thank you
p.s.: ;-) yes, also, but loath
I edit my post with shutdown and without reboot
regards,
maxprox
 
The procedure is not complete, the firewall does not follow.

mv /etc/pve/firewall/106.fw /etc/pve/firewall/104.fw
pve-firewall restart
 
Last edited:
  • Like
Reactions: Corwin