[SOLVED] lvm disk migration

almiller

Member
Dec 1, 2020
21
0
21
58
Somewhere along my journey I messed up my lvm usage and didn't realize I was putting mv vm disks in the wrong volume group.
I have proxmox 8.3.0 installed on a Dell R710 with 2 VGs (pve and vmdata)
  • pve (1.8TB) should only be for the OS
  • vmdata (7.3 TB) is where I intended to store all my VM data
Is it possible to migrate the LVs from the pve VG to the vmdata VG? Something like
  1. shutdown the VM,
  2. migrate the disks using lvm commamnds,
  3. correct the paths in /etc/pve/nodes/proxmox/qemu-server/<vmid>.conf
  4. startup the VM

Code:
root@proxmox ~ # vgs
  VG     #PV #LV #SN Attr   VSize  VFree
  pve      1  37   0 wz--n- <1.82t 16.00g
  vmdata   1   7   0 wz--n- <7.28t  5.92t

But I see I have lots of LVs in "pve" that are disks from my VMs

Code:
root@proxmox ~ # lvs pve
  LV               VG  Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  base-902-disk-0  pve Vri---tz-k  <2.20g data
  base-903-disk-0  pve Vri---tz-k  32.00g data
  data             pve twi-aotz--  <1.67t             23.80  1.07
  root             pve -wi-ao----  96.00g
  swap             pve -wi-ao----   8.00g
  vm-100-cloudinit pve Vwi-a-tz--   4.00m data        9.38
  vm-100-disk-0    pve Vwi-a-tz--  32.00g data        19.57
  vm-100-disk-1    pve Vwi-a-tz--  10.00g data        0.00
  vm-101-disk-0    pve Vwi-aotz-- 100.00g data        17.99
  vm-102-disk-0    pve Vwi-a-tz-- 100.00g data        63.29
  vm-102-disk-1    pve Vwi-a-tz--  32.00g data        22.50
  .......
 
Assuming you have the Proxmox Storage for that VG vmdata correctly configured within the /etc/pve/storage.cfg , I believe the best route for you would be simply to move the disks within the PVE GUI. This should be possible by selecting the <VM>, Hardware, Hard Disk & then choose the dropdown Disk Action & selecting Move Storage.

Always have fully restorable backups when performing any of the above!
 
Great! I didn't know that was possible. I tried that and it seems to have worked just fine. Didn't have to edit/reconfigure anything.

My storage.cfg looks ok

Code:
root@proxmox ~ # cat  /etc/pve/storage.cfg
dir: local
    path /var/lib/vz
    content iso,vztmpl,backup
lvmthin: local-lvm
    thinpool data
    vgname pve
    content images,rootdir
lvm: vmdata
    vgname vmdata
    content rootdir,images


Screen Shot 2024-11-25 at 15.48.07 PM.png

Screen Shot 2024-11-25 at 15.48.36 PM.png


Screen Shot 2024-11-25 at 15.49.00 PM.png

Code:
root@proxmox ~ # grep ^scsi   /etc/pve/nodes/proxmox/qemu-server/100.conf
scsi0: vmdata:vm-100-disk-0,cache=none,discard=on,iothread=1,size=10G,ssd=1
scsi1: vmdata:vm-100-disk-1,size=32G
scsihw: virtio-scsi-pci

I guess I can just delete the "unused" disks that are left over.

Screen Shot 2024-11-25 at 15.57.54 PM.png
 
Looks like you got it solved.
Maybe mark this thread as solved. At the top of the thread, choose the Edit thread button, then from the (no prefix) dropdown choose Solved.
 
As an additional solution to prevent VMs for being moved back into the pve VG you can think of removing the image option from the storage
 

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!