Local migration to new disk (lvm-thin)

keeka

Well-Known Member
Dec 8, 2019
204
24
58
I have all VMs and CTs on a single LVM-thin volume, in a dedicated VG consiting of one partiton occupying entire single disk.
I'd like to migrate the VM/CT volumes it contains to a new disk. I am not sure what the best way to do this is. I considered disk cloning but the target drive's available space is less than the source, since I want to over-provision the new drive.
AIUI I do this:
Use the web UI to create the new lvm thin volume and assign it to a pve store. Then, use web UI migrate tool to copy the disk images over. Then decomission the old drive. Proxmox adjusts the vm configs or perhaps I do so myself.
I read this post that indicates images are not sparse copied. What should I do with those disk images where I am unable or unsure to run discard/fstrim? e.g. a pfsense guest's root disk.

Also, it would be interesting to know how to perform a migration 'manually' using lvm commands and potentially retain sparse images without the need to run trim commands in guests or the pve trim command against CT root disk volumes.

Any advice or explanation much appreciated.
Many thanks.
 
If you move the disk to a new lvm-thin storage when the VM is offline, the disks should still be sparse.
(GUI -> VM -> Hardware -> Select a disk -> 'Move Disk' button at the top)
 
  • Like
Reactions: _gabriel
Thank you mira. I've just successfully moved them and they did indeed remain sparse. I took the precaution of shutting down each VM/CT first.

One issue I encountered was, the move process stalling at the end of a copy. I tracked this down to attempting a move whilst the pve metrics endpoint was unavailable (influxdb was on a container I'd shutdown to move!). So I temporarily disabled metrics.
 

About

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!