[SOLVED] VM disk controller, drive and boot order shuffled after migration

C.G.B. Spender

Active Member
Nov 17, 2019
29
0
41
Hi,
I bought a bit stronger machine for my pve, I added the new pve in cluster, migrated the vms. So far all good.

One debian VM doesn't come up. Upon investigation it gets stuck at looking for boot device. After some troubleshooting (read flipping checkboxes and rebooting and hoping for the best) I've found out the order of the disks got shuffled during the migration and it wants to boot from the 2nd drive. After adjusting the boot order in vm options it boots ok, however herein lies the issue:

original vm:
scsi0: disk0 /dev/sda
scsi1: disk1 /dev/sdb
boot order: scsi0

migrated vm:
scsi0:disk1 /dev/sda
scsi1: disk0 /dev/sdb
boot order: scsi0 <---- does not work until switched to scsi1

Moreover, I somehow need to move the boot loader from disk1 back to disk0. disk1 is is a large temporary data storage disk excluded from backups due to space constraints. By not backing it up I'm now backing up unbootable vm.

I tried grub-install /dev/sdb and update-grub and then reboot with the boot order switched to the small disk, but no dice. Backing up both disks is not an option.
How could I move the boot to disk0 so the backups are bootable?

Thanks for any suggestion
 
Hi,

changing type and port number of the used storage controller can be done by detaching and re-attaching the disk, which is done by a few clicks.
  1. in Hardward menu of the vm: select first disk
  2. click on detach, disk is now labeled as Unused Disk 0
  3. select second disk
  4. click on detach, disk is now labeled as Unused Disk 1
  5. select Unused Disk 1
  6. click edit and assign storage controller type, id and other options
  7. repeat for Unused Disk 0
For this to work, vm must be stopped.
 
  • Like
Reactions: C.G.B. Spender