LVM Content Not Displaying Content After Manual Copy

ejc317

Member
Oct 18, 2012
263
0
16
So we've figured out a workaround for KVM templates but we were wondering about something

A) if we create the VM in proxmox GUI and then copy the .raw file into the ISCSI volume at /dev/PL-C-SAN/vm-100-disk-1 - and you click on the LVM, it shows that .raw image fine
B) if we manually create the lv and then copy the .raw file into the ISCSI volume, the .raw image doesn't show up in the GUI when you click on the storage. How do we

1) make this show up
2) if we delete it make sure its deleted

Do we have to mount it and go in manually?

Thank you
 
What volume name did you use exaclty?

The volume name is correct - the VM starts up fine with the image etc

so i.e

vm-101-disk-1 as the LV but the .raw image file doesn't show up when I click on my LVM.

Now when I create the vm first and then copy the .raw image to overwrite (the image is named vm-101-disk-1.raw in both cases) - it shows up just fine
 
A few more updates

so I use kpartx to mount the LV. After doing so (if the LV was created via proxmox GUI, seems like there's 2 partitions? one is a vm-101-disk-1p1 which a lot more space and one is like 2mb? is this normal?)

In any case, I can mount / unmount with kpartx fine but can I change the name of this 1p1 partition? I guess where is the .raw file that i'm try to edit.

If I copy into the LV a file called files.raw - can I change it to vm-100-disk-1.raw?
 
A few more updates

so I use kpartx to mount the LV. After doing so (if the LV was created via proxmox GUI, seems like there's 2 partitions? one is a vm-101-disk-1p1 which a lot more space and one is like 2mb? is this normal?)

In any case, I can mount / unmount with kpartx fine but can I change the name of this 1p1 partition? I guess where is the .raw file that i'm try to edit.

If I copy into the LV a file called files.raw - can I change it to vm-100-disk-1.raw?
Hi,
an LV has no filesystem - so you can't use copy (cp). The LV is the image of an harddisk - with MBR, Partitiontable and so on (depends how you use the disk in your VM).
You can use block-copy (dd) to copy raw-files (which are also images of harddisks but as real file on a filesystem) to an LV like:
Code:
dd if=/var/lib/vz/images/vm-101-disk-1.raw of=/dev/iscsivg/vm-101-disk-1 bs=1024k
Udo
 
I created a VM-100 with 50GB iscsi volume

then manually created a VM-101 iscsi LV ... the storage shows 100GB used but under images - there's nothing there ... strange
 
We use lvm tags to identify volumes used by PVE:

# lvs --options vg_name,lv_name,lv_size,tags

to see those tags. If you use 'pvesm alloc' those tags are automatically created for you.
 
We use lvm tags to identify volumes used by PVE:

# lvs --options vg_name,lv_name,lv_size,tags

to see those tags. If you use 'pvesm alloc' those tags are automatically created for you.

I see it now - it's missing the tags - i did pvesm alloc - what is filename?
 
So I did lvchange /dev/PL-C-SAN/vm-101-disk-1 --addtag pve-vm-101

and now it shows up!

However, should I still do it via pvesm alloc? i assume that filename is the name of the .raw file? is there any benefit to doing it one way or another?
 
However, should I still do it via pvesm alloc? i assume that filename is the name of the .raw file?

Try using '/vm-101-disk-1'

is there any benefit to doing it one way or another?

Please use 'pvesm' if you use LVM on shared storage, because that does cluster wide locking.
 
Thanks Dietmar

1) Does that mean we should use PVESM add to add storage rather than create our own LV?

2) What are the risks of not using PVESM alloc - re clusterwide locking?
 
Okay I think I got it - instead of using lvcreate we should just do pvesm alloc - it'll create the LV - we create the VM after that using qm create - link the paths, block copy a .raw into it. I guess what we were confused about is the name of the .raw in proxmox GUI vs the .raw that I block copy

i.e if i copy something like randomname.raw - the system will still boot but it doesn't show in the gui. I can mount the LV using kpartx and it'll show the 2 .raw's - is there anyway to make BOTH of them show in proxmox GUI? The reason we ask is for backup purposes


In other words, after I do

1) PVESM alloc to create an LV
2) QM create to create the VM
3) Link VM to the LV that was just created in the vmid.conf
4) boot VM - the GUI will show vmid raw image but when you start it there's nothing in there (as expected)

Now if I copy in a .raw file as a block into the LV it'll boot. If I copy 2 - i can see them both but the GUI will not distinguish ... is there a good way of making sure the GUI accurately reflects what we did?
 
Last edited:
Hi,
an LV has no filesystem - so you can't use copy (cp). The LV is the image of an harddisk - with MBR, Partitiontable and so on (depends how you use the disk in your VM).
You can use block-copy (dd) to copy raw-files (which are also images of harddisks but as real file on a filesystem) to an LV like:
Code:
dd if=/var/lib/vz/images/vm-101-disk-1.raw of=/dev/iscsivg/vm-101-disk-1 bs=1024k
Udo


Udo - what if we copy 2 .raw files into that drive? I assume they would overwrite each other. We'd have to create two LVs for the VM and copy a .raw file into separate LVs in order to have two "hds"?
 
Another question is if my .raw file is 10gb but the LV is 50gb - do I need to resize the raw file with qemu-img resize before? or can I do it after?
 

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!