How to transfer LVM Thin disk from an old drive to new proxmox server?

torontob

Renowned Member
Oct 18, 2010
48
0
71
I had an old drive failing and removed it from Proxmox 4.4.1. It was the main drive there. I installed new drives and installed Proxmox 8.2.1(latest).

On the old drive, I did dd with --sparse for copying a /dev/mapper/vm--disk-1 and now it shows 100GB and I transferred it to the new server /dev/mapper using rsync ssh.

But it is not showing as a disk in there. This was part of ide0 hardware of my Windows VM boot disk.

How to get the VM up and running again now that the file is dd copied and is not a lvm thin?

If this is not possible, I still have the original old drive and can copy again in a different way if needed.

Thanks.
 
Last edited:
I did migrations recently and used
/usr/sbin/qm remote-migrate
However, both machines were running proxmox. One machine, the sender, did have thin drives and the receipient server did not. After tha transfer I did a
qemu-img convert -c -O qcow2
to shrink the drive down.
HTH
 
I did migrations recently and used
/usr/sbin/qm remote-migrate
However, both machines were running proxmox. One machine, the sender, did have thin drives and the receipient server did not. After tha transfer I did a
qemu-img convert -c -O qcow2
to shrink the drive down.
HTH

Thanks.

The old machine is not running anymore. What is the solution now?
 
On the old drive, I did dd with --sparse for copying a /dev/mapper/vm--disk-1 and now it shows 100GB and I transferred it to the new server /dev/mapper using rsync ssh.
device entries under /dev/mapper are not regular files. You can copy data out of that device, but you cant just place a regular file under /dev/mapper and expect it to work...

The high level:
a) copy data via dd from LVM slice /dev/mapper/vm--disk-1 into some file: mydisk.raw
b)copy the file over
c) create new LVM slice, either manually or via PVE (pvesm alloc local-lvm 100 vm-100-disk-0 100)
d) dd the file to new slice: if=mydisk.raw of=/dev/mapper/vm--disk-0
e) rescan disks: qm disk rescan
f) update VM config
profit

Good luck


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
 
device entries under /dev/mapper are not regular files. You can copy data out of that device, but you cant just place a regular file under /dev/mapper and expect it to work...

The high level:
a) copy data via dd from LVM slice /dev/mapper/vm--disk-1 into some file: mydisk.raw
b)copy the file over
c) create new LVM slice, either manually or via PVE (pvesm alloc local-lvm 100 vm-100-disk-0 100)
d) dd the file to new slice: if=mydisk.raw of=/dev/mapper/vm--disk-0
e) rescan disks: qm disk rescan
f) update VM config
profit

Good luck


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox

Thanks.

"pvesm alloc local-lvm 100 vm-100-disk-0 100" command must be run in /dev/mapper?

It seems I have to do c), d), e) f) from your post. Can you please re-check if all commands are to be run exactly as you said and nothing else needed (except for file name changes)?

Also, when I did dd, I did not add .raw to file. Is that ok?
 
"pvesm alloc local-lvm 100 vm-100-disk-0 100" command must be run in /dev/mapper?
The location of where you run the command from does not matter, as it does not interact directly with current directory.
You'd potentially need to adjust storage name (3rd argument) and VMID. Note the last argument is size.

It seems I have to do c), d), e) f) from your post. Can you please re-check if all commands are to be run exactly as you said and nothing else needed (except for file name changes)?
The commands I provided were off-the-top of my head, there may be typos or syntax mistakes. The best way to check is to consult man pages for relevant binaries, ie "man qm".

Also, when I did dd, I did not add .raw to file. Is that ok?
The filename or extension do not matter
I did dd with --sparse
Regarding you question about sparse - GNU dd does not take options in "--option" format, so I am not sure what you did there. If you wanted to try sparse, it would be "conv=sparse".
dd if=mydisk.raw of=/dev/mapper/vm--disk-0
If thats the correct path to appropriate disk, then the syntax should be ok


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
 
Last edited:
Thanks.

I put 100 for size stupidly. How to expand to 100GB or simply rm it and do new one?

I tried putting name, id of VM etc but failing to remove.

pvesm remove 20232
400 Parameter verification failed.
storage: invalid format - storage ID '20232' contains illegal characters

pvesm remove <storage>
 
Last edited:
the number is implied to be GB, the command does not take qualifying suffix. "100" is 100GB. 1000 is 1TB., etc


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
Are you sure? Because when I tried to dd into that it right away said ran out of space.
Also I see pic below size is very little. Documentation said 1024M for 1GB I think
 

Attachments

  • pve.JPG
    pve.JPG
    36.2 KB · Views: 0
Are you sure? Because when I tried to dd into that it right away said ran out of space.
Also I see pic below size is very little. Documentation said 1024M for 1GB I think
You are correct, I was thinking of a different command. Documentation has the answer.
Just redo the disk:
pvesm list [storage]
pvesm free [storage:disk]
pvesm alloc [correct options]


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
 
So how to remove the existing one? I am failing with pvesm remove 20232 (id of VM) and I tried device name and failed too.
I want to remove to recreate with 1024M (100GB)
 
pvesm free [storage:disk]
^
man pvesm
Code:
pvesm free <volume> [OPTIONS]

       Delete volume

       <volume>: <string>
           Volume identifier

       --delay <integer> (1 - 30)
           Time to wait for the task to finish. We return null if the task finish within that time.

       --storage <storage ID>
           The storage identifier.

Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
 
^
man pvesm
Code:
pvesm free <volume> [OPTIONS]

       Delete volume

       <volume>: <string>
           Volume identifier

       --delay <integer> (1 - 30)
           Time to wait for the task to finish. We return null if the task finish within that time.

       --storage <storage ID>
           The storage identifier.

Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox


Thanks, that worked but like pvesm free local-lvm:vm-disk basically TAB it all the way.

I did create a new one like this:
pvesm alloc local-lvm 20232 vm-20232-disk-1 102400M

and I GUI I see 107.37GB. Is that ok for the 100GB disk I have? or must it be exactly 100GB?
 

Attachments

  • 1719518955202.png
    1719518955202.png
    26 KB · Views: 1
I did create a new one like this:
pvesm alloc local-lvm 20232 vm-20232-disk-1 102400M

and I GUI I see 107.37GB. Is that ok for the 100GB disk I have? or must it be exactly 100GB?
Unfortunately PVE is not consistent in its use of units.
The documentation states that meGABYtes are used with M, yet likely meBIBYtes are used

Plug this into google: 102400 mebibytes to gigabytes

Its fine for disk to be larger


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
 
Unfortunately PVE is not consistent in its use of units.
The documentation states that meGABYtes are used with M, yet likely meBIBYtes are used

Plug this into google: 102400 mebibytes to gigabytes

Its fine for disk to be larger


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox

Thanks. This seems to have worked.

I think I am missing another disk which was named similarily but from local-raid1 which was another set of hard drives. I see is in the path but I don't see the local-raid1 as storage inside GUI. How to add storage? what I marked 1 is I think good but what I marked 2 is a storage yet.

VM starts with ide0 all good. Missing is ide1 now.

1719521492482.png


1719521288127.png

1719522225762.png


Addition: I was able to add that storage using Datacenter. Storage addition was in a sneaky place. Added it as a directory and seems to have worked. Now time to add it in Windows.


Thanks for all the tips.
 

Attachments

  • 1719522181554.png
    1719522181554.png
    111.3 KB · Views: 0
Last edited:

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!