[SOLVED] renamed/moved disk image to another vm not consistent between reboots


Jul 22, 2017

I'm migrating a disk image (scsi) from one vm to another, it's just a filesystem on it with configuration files basically.

The way I did it was like below, and it works. But after a reboot of the server, the disk image renamed itself back to the old name and therefore is no longer attached to the new vm. I'm guessing there might be a configuration file somewhere which keeps track of this?

How can I move a disk image between virtual machines end keep it consistent between reboots?

The procedure I did is mostly taken from this guide: https://pve.proxmox.com/wiki/Moving_disk_image_from_one_KVM_machine_to_another

Moving vm-105-disk-1 from vm number 105 to vm number 100:

root@homelab:/dev/pve# ls -l
lrwxrwxrwx 1 root root 7 May 10 16:44 root -> ../dm-3
lrwxrwxrwx 1 root root 7 May 10 16:44 swap -> ../dm-2
lrwxrwxrwx 1 root root 8 May 10 16:46 vm-100-cloudinit -> ../dm-15
lrwxrwxrwx 1 root root 8 May 10 16:46 vm-100-disk-0 -> ../dm-14
lrwxrwxrwx 1 root root 8 May 10 16:44 vm-105-cloudinit -> ../dm-12
lrwxrwxrwx 1 root root 8 May 10 16:44 vm-105-disk-0 -> ../dm-11
lrwxrwxrwx 1 root root 8 May 10 16:44 vm-105-disk-1 -> ../dm-13 <---Move this to vm 100

"Rename" disk
root@homelab:/dev/pve# mv vm-105-disk-1 vm-100-disk-1

* Removing config line "scsi1: local-lvm:vm-105-disk-1,size=50G" from /etc/pve/qemu-server/105.conf

Update configuration file for vm-100:
root@homelab:/dev/pve# cat /etc/pve/qemu-server/100.conf
scsi0: local-lvm:vm-100-disk-0,size=32G
scsi1: local-lvm:vm-100-disk-1,size=50G
This disk seems to be on a lvm / lvm-thin type of storage.
* use `lvrename` for the renaming
* make sure that you don't need the disk in the other guest (105)
* you can also use `qm rescan` after the rename - the disk should appear as unused0 in the config of 100

hope this helps!
  • Like
Reactions: Joakim_1995
That absolutely helps! This works between reboots, yeey :D

Reference for other homelabbers:
root@homelab:/dev/pve# lvrename /dev/pve/vm-105-disk-1 /dev/pve/vm-100-disk-1
Renamed "vm-105-disk-1" to "vm-100-disk-1" in volume group "pve"


The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!