[HOWTO] How to replace system disk in a proxmox server minimizing downtime

Notice: Page may contain affiliate links for which we may earn a small commission through services like Amazon Affiliates or Skimlinks.

piranha32

Active Member
Mar 4, 2023
240
176
43
[EDIT]: VM transfer method described here works only if all your VMs use storage on the system disk.

I wanted to share a little trick, which I learned today while upgrading the system disk in my proxmox server. Most of it is pretty obvious, except one little detail, which I learned the hard way.

You will need the following:
- a new disk
- some way of attaching it to the system. For SATA and NVME disks, a USB adapter is sufficient, SAS/U.x disks need to be connected using a corresponding interface.

To minimize the downtime caused by replacement of the system disk, it is necessary to have the disk with the OS ready to run, and all VMs transferred before the swap.

To install the OS, create a disk-less VM, and map the new disk to it. Install the OS, and configure all system-wide options you usually change (IOMMU, etc). From this point, you can't reboot the host OS with the new disk connected. Your current system disk and the new disk contain VGs with name "pve". It's not a problem until the new disk is attached to the VM, but once the host OS picks it up, two VGs with the same name will create conflicts and a lot of confusion.

Now comes the tricky part:
The name of the network interfaces in the VM and on bare metal are different. Proxmox uses hardware-based network interface names, and once you install the disk in the host machine, the interface used to set up networking will no longer exist, network connectivity will not work, and you will need access to the system console to fix it.
Check what are the names of interfaces in the current install, and change the names in /etc/network/interfaces. At this point you can't reboot the VM, because networking will not start after reboot. You can also change IP address(es) to what is used by the current system, but this step can be done later. Just remember to connect to the IP address which the DHCP server issued for the VM during system installation.

The last operation is transfer of the VMs. Back up all the VMs you want to transfer on a medium, which can be attached to the VM with your new proxmox install. I used NFS share, but it should be possible to use a USB stick (I haven't tested it). To avoid inconsistences, it's best to shut down the VMs before backup, so plan it well. The most critical VM should be backed up last.
Once the backup is done, restore the VMs in new OS. Backups made on networked storage can be restored while other VMs are being backed up, locally connected backup disk will have to be attached to your system install VM before restore.

With all VMs restored, shut down the server, swap the disk, and power up the machine on. If you did all the steps correctly, there is a chance that all the VMs will be up and running by the time you return to your desk.
 
Last edited: