new to proxmx - how do i add an existing image ?

e-ferrari

New Member
Oct 10, 2024
2
0
1
Hi Forum,
i'm new to proxmox. About LVM i know something, but not about thin provisioning.
What i want:
import virtual machines from a qemu/KVM/libvirt instance.
What i did:
I created a virtual machine inside proxmox, it has id 100.
I have a LVM thin pool called "data", it resides in a volume group "pve".
In the thin pool i have a logical volume "vm_s", formatted with ext4 and mounted.
In the web interface i have two storages: local and local-lvm. I see local-lvm with the correct size
but it's empty. local-lvm ist the storage-ID. I copied the image (raw file) from the qemu/KVM/libvirt instance to the logical volume "vm_s".
In the web interface proxmox recognizes that the image-file occupies disk space, but it does not show the file.
I named the file "vm-100-disk-1.raw". Is that correct ? Does it have to be directly in the lv, or in a subfolder "100" ?
I edited /etc/pve/qemu-server/100.conf and played around with the volume id.
Currently it looks:
virtio0: local-lvm:data/vm-100-disk-1.raw,format=raw

But i get two errors when changing the volume id:
"lvm name 'data/vm-100-disk-1.raw' contains illegal characters" or
"no such logical volume pve/vm-100-disk-1.raw".

Is the name for the image file correct?
Is it correct that i created a logical volume in the thin pool ?
Is it correct that i copied the image file to the lv in the thin pool, not to the thin-pool directly ?
How does the correct volume-ID looks like ?

Thanks.

Bernd
 
Hi @e-ferrari , welcome to the forum.
In the thin pool i have a logical volume "vm_s", formatted with ext4 and mounted.
mounted where?
I see local-lvm with the correct size
this is raw storage pool. volumes will be carved out from it as necessary
I named the file "vm-100-disk-1.raw". Is that correct ?
it correct for raw files. Examine your file with "qemu-img info [filename]" to learn more about its structure
I edited /etc/pve/qemu-server/100.conf and played around with the volume id.
dont directly edit config file until you really know what you are doing
virtio0: local-lvm:data/vm-100-disk-1.raw,format=raw
this is not correct. Based on your discription vm-100-disk-1.raw is an actual file located on a filesystem. Local-lvm is a raw block pool
I'd recommend reviewing "qm" man page section about importing a disk:
https://pve.proxmox.com/pve-docs/qm...sk import <vmid> <source> <storage> [OPTIONS]

A sample command: qm importdisk $VMID [absolute_path_to_file] $STORAGE_POOL

Good luck


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
 
Hi bbgeek17,
thanks for your help.

mounted where?
/mnt/vm_s

this is raw storage pool. volumes will be carved out from it as necessary
Does that mean to use a LV thin pool i need to create logical volumes in it ?

dont directly edit config file until you really know what you are doing
OK

this is not correct. Based on your discription vm-100-disk-1.raw is an actual file located on a filesystem. Local-lvm is a raw block pool
I'd recommend reviewing "qm" man page section about importing a disk:
https://pve.proxmox.com/pve-docs/qm.1.html#:~:text=qm disk import <vmid> <source> <storage> [OPTIONS]

A sample command: qm importdisk $VMID [absolute_path_to_file] $STORAGE_POOL
I created a logical volume in the LV thin pool, formatted it with ext4 and mounted it on /mnt/vm_s. And there i put the image file.
That was wrong ?

I checked the manpage.
Does that mean that the image file has to be already accessible on the Proxmox host?
Or can i import it via scp from another host?
And what is about the storage_pool local-lvm? It must not be formatted?

Bernd
 
Does that mean to use a LV thin pool i need to create logical volumes in it ?
No, PVE will do it automatically if you made PVE aware of the pool.
"local-lvm" is part of default PVE installation and PVE is aware of it in your case.
I created a logical volume in the LV thin pool, formatted it with ext4 and mounted it on /mnt/vm_s. And there i put the image file.
This workflow is not part of normal PVE management, but there is nothing wrong with it per say. Many people take a slice of the larger local-vm pool to isolate files they want to store from the root partition.
At this point PVE does not know anything about /mnt/vm_s - its a mountpoint for your own use. If you want PVE to see your file and use it directly as file, you should move your RAW file to /var/lib/vz/images/[vmid] which is known to PVE as "local" storage pool.
I.e. /var/lib/vz/images/100/vm-100-disk-0.raw
Does that mean that the image file has to be already accessible on the Proxmox host?
yes, it does. In your particular case it is available as file in /mnt/vm_s
Or can i import it via scp from another host?
"qm import disk" does not support workflow with scp. You can do some creating piping, however, thats outside of the scope.
And what is about the storage_pool local-lvm? It must not be formatted?
Its already "formatted" via LVM. Its in a correct state for PVE to use. Its not a filesystem.



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

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!