Copy VM disk from one installed disk to a new one

Charry2014

New Member
Mar 7, 2024
10
3
3
A bit confused by this one - I had a perfectly running Proxmox VE 8.2.2, with one VM I was actually using, and all this was running on a M.2 disk in an Intel NUC. As I need to use the M.2 slot for something else I added a SATA disk to the NUC and installed the same version of Proxmox again, thinking it would then be simple to just copy the VM from the M.2 to the new installation on the SATA. Unfortunately this SATA install seems to have modified the M.2 installation and rebooting this no longer shows me the working VM.

I am sure it is easy, I just can't see how. The VM I want to get to is vm-100-disk-0. I kinda understand the structure of the disks and volumes, but have no idea how to copy this VM onto the new SATA install.

The M.2 disk containing the working VMs is a 256GB Samsung on sdb, the new SATA is a 512GB Western Digital on sda. Below some information -

Code:
root@pmox02:~# fdisk -l
Disk /dev/sda: 465.76 GiB, 500107862016 bytes, 976773168 sectors
Disk model: WDC WD5000BPVT-8
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 9D77E208-B454-4F29-9469-21F73768FB26

Device       Start       End   Sectors   Size Type
/dev/sda1       34      2047      2014  1007K BIOS boot
/dev/sda2     2048   2099199   2097152     1G EFI System
/dev/sda3  2099200 976773134 974673935 464.8G Linux LVM

Partition 1 does not start on physical sector boundary.


Disk /dev/sdb: 232.89 GiB, 250059350016 bytes, 488397168 sectors
Disk model: Samsung SSD 850
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: C70FEB43-3AD8-4493-ACAA-EF1BEA895F2E

Device       Start       End   Sectors   Size Type
/dev/sdb1       34      2047      2014  1007K BIOS boot
/dev/sdb2     2048   2099199   2097152     1G EFI System
/dev/sdb3  2099200 488397134 486297935 231.9G Linux LVM


Disk /dev/mapper/pve--OLD--59227224-swap: 8 GiB, 8589934592 bytes, 16777216 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/pve--OLD--59227224-root: 67.97 GiB, 72980889600 bytes, 142540800 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/pve-swap: 8 GiB, 8589934592 bytes, 16777216 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/mapper/pve-root: 96 GiB, 103079215104 bytes, 201326592 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/mapper/pve--OLD--59227224-vm--100--disk--0: 50 GiB, 53687091200 bytes, 104857600 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 65536 bytes / 65536 bytes
Disklabel type: dos
Disk identifier: 0xfb138c58

Device                                                Boot     Start       End   Sectors  Size Id Type
/dev/mapper/pve--OLD--59227224-vm--100--disk--0-part1 *         2048 102856703 102854656   49G 83 Linu
/dev/mapper/pve--OLD--59227224-vm--100--disk--0-part2      102858750 104855551   1996802  975M  5 Exte
/dev/mapper/pve--OLD--59227224-vm--100--disk--0-part5      102858752 104855551   1996800  975M 82 Linu

Partition 2 does not start on physical sector boundary.


Disk /dev/mapper/pve--OLD--59227224-vm--101--disk--0: 8 GiB, 8589934592 bytes, 16777216 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 65536 bytes / 65536 bytes


Disk /dev/mapper/pve--OLD--59227224-vm--102--disk--0: 32 GiB, 34359738368 bytes, 67108864 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 65536 bytes / 65536 bytes


Disk /dev/mapper/pve--OLD--59227224-vm--103--disk--0: 4 GiB, 4294967296 bytes, 8388608 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 65536 bytes / 65536 bytes


Disk /dev/mapper/pve--OLD--59227224-vm--100--state--WorkingFrigateInstall: 32.49 GiB, 34884026368 bytes, 68132864 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 65536 bytes / 65536 bytes


Disk /dev/mapper/pve--OLD--59227224-vm--100--state--Workingfrigate01: 32.49 GiB, 34884026368 bytes, 68132864 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 65536 bytes / 65536 bytes

And

Code:
root@pmox02:~# pvs
  PV         VG               Fmt  Attr PSize    PFree 
  /dev/sda3  pve              lvm2 a--  <464.76g 16.00g
  /dev/sdb3  pve-OLD-59227224 lvm2 a--   231.88g 16.00g

root@pmox02:~# lvs
  LV                                       VG               Attr       LSize   Pool Origin        Data%  Meta%  Move Log Cpy%Sync Convert
  data                                     pve              twi-a-tz-- 337.86g                    0.00   0.50                           
  root                                     pve              -wi-ao----  96.00g                                                           
  swap                                     pve              -wi-ao----   8.00g                                                           
  data                                     pve-OLD-59227224 twi-aotz-- 137.11g                    12.18  1.56                           
  root                                     pve-OLD-59227224 -wi-a----- <67.97g                                                           
  snap_vm-100-disk-0_WorkingFrigateInstall pve-OLD-59227224 Vri---tz-k  50.00g data vm-100-disk-0                                       
  snap_vm-100-disk-0_Workingfrigate01      pve-OLD-59227224 Vri---tz-k  50.00g data vm-100-disk-0                                       
  swap                                     pve-OLD-59227224 -wi-a-----   8.00g                                                           
  vm-100-disk-0                            pve-OLD-59227224 Vwi-a-tz--  50.00g data               19.08                                 
  vm-100-state-WorkingFrigateInstall       pve-OLD-59227224 Vwi-a-tz-- <32.49g data               5.32                                   
  vm-100-state-Workingfrigate01            pve-OLD-59227224 Vwi-a-tz-- <32.49g data               5.32                                   
  vm-101-disk-0                            pve-OLD-59227224 Vwi-a-tz--   8.00g data               8.33                                   
  vm-102-disk-0                            pve-OLD-59227224 Vwi-a-tz--  32.00g data               4.25                                   
  vm-103-disk-0                            pve-OLD-59227224 Vwi-a-tz--   4.00g data               41.37

Thank you in advance for any help.
 
OK - thank you that got the VM up and running, but with the VM volume still located on the M.2 disk I want to remove. How do I go about moving the volume onto the other disk? Is this where it is necessary to backup the VM and then restore it to a different location?
 
  • Like
Reactions: Kingneutron
Let me answer my own question - that is exactly how I did it. Ran the Backup procedure on the Proxmox node and then Restore, but selected the
Code:
local-lvm
storage for the restore destination. A bit of fiddling to correct some minor quirks in my particular setup and everything works. (For anyone interested the quirks were the MAC address is not the same as the original VM kinda obviously, and the USB passthrough settings for the Coral accelerator were not restored correctly).
 
Aha, that is somewhat logical, but I come from an older version of ESXi and such options are under storage (IIRC). Thank you for the tip.
 

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!