local-lvm path?

PonyoHam

Member
May 23, 2018
20
1
8
39
Hi,

I'm struggling with storage and Proxmox. I got a default installation and under storage I see local (directory) and local-lvm (LVM-thin). local has /var/lib/vz as path and local-lvm has no path.

The content for local-lvm is disk image so I assume every VM I create is store there. But what is the path? I want to resize the virtual disk for one of my VMs but I cannot find the disk location. I can see all disks in /dev/pve/ but all of them appear to be 0 in size and the qemu-img resize is giving an error saying something like disk 101 not being a image.
 
In the GUI you can resize the disk, on the hardware tab select the disk and hit the resize button above.
 
That only allows you to increase the disk size, not to shrink it. I believe you need to use the cli for that.

Even if it could be done from the gui, I still want to know actually where local-lvm stores its data because its not in any of the directories mentioned in the documentation.
 
That only allows you to increase the disk size, not to shrink it. I believe you need to use the cli for that.
The filesystem needs separate adjustment inside the VM. LVM cannot resize all filesystems out there.

Even if it could be done from the gui, I still want to know actually where local-lvm stores its data because its not in any of the directories mentioned in the documentation.
As logical volumes, see the links below.

Our storage docs for LVM and LVM-thin backend: https://pve.proxmox.com/pve-docs/chapter-pvesm.html#_lvm_backend
Debian docs on LVM: https://wiki.debian.org/LVM
General docs on LVM: http://www.tldp.org/HOWTO/LVM-HOWTO/whatislvm.html
 
Those links don't really answer my question?

root@proxmox:/dev/pve# pvesm path local-lvm:vm-100-disk-1
/dev/pve/vm-100-disk-1

Is this the actual location of the file? Size appears to be 0 and no extension.


root@proxmox:/dev/pve# qemu-img resize /dev/pve/vm-100-disk-1 – – -11GB
qemu-img: Expecting one image file name
Try 'qemu-img --help' for more information

Doesn't work but when I add -shrink it does though lvs still shows the image as 120GB. If I directly edit the VM and change it to 11GB (first used gparted to shrink the partition, I migrated this image from a physical machine) it does show as 11GB in the GUI but lvs still shows 100-disk-1 as 120GB.

It seems to work but.... is it really the correct way? Seems to me /dev/pve/ isn't the actual location of the disk image file.
 
root@proxmox:/dev/pve# pvesm path local-lvm:vm-100-disk-1
/dev/pve/vm-100-disk-1

Is this the actual location of the file? Size appears to be 0 and no extension.
This is not a regular file, this is a block device. (but, finally in linux all is a file :) )

In a simple way, lvm-thin storage - like a physical hard drive, /dev/pve/vm-100-disk-1 like a partition on that drive.

If I directly edit the VM and change it to 11GB (first used gparted to shrink the partition, I migrated this image from a physical machine) it does show as 11GB in the GUI but lvs still shows 100-disk-1 as 120GB.
You can create another disk for that VM with appropriate size. Boot VM from any live CD and copy data from larger disk to new, after that change boot disk to new in VM config, test boot from new disk and remove old disk.
 
  • Like
Reactions: PonyoHam
This is not a regular file, this is a block device. (but, finally in linux all is a file :) )

In a simple way, lvm-thin storage - like a physical hard drive, /dev/pve/vm-100-disk-1 like a partition on that drive.


You can create another disk for that VM with appropriate size. Boot VM from any live CD and copy data from larger disk to new, after that change boot disk to new in VM config, test boot from new disk and remove old disk.

Thanks, that helps clear things up :)

I ended up using gparted and clonezilla to make a new image with a smaller size but I'll try copying the data next time.
 
Thanks, that helps clear things up :)

I ended up using gparted and clonezilla to make a new image with a smaller size but I'll try copying the data next time.

Wow! Thank you very much! This helped a lot.

FIX YOUR DOCUMENTATION PROXMOX!!!

Why does your wiki talk about shrinking like it is something you can actually do? Why not just put these two damn sentences in it? Why lead us in circles around the "qm resize" commands, or the "qemu-img resize" garbage?

Why not say, "We're sorry, but you cannot resize your LVM-Thin disk once it is created. To fix this issue, use GParted to shrink your disk to the desired size, create a new disk that is the target size you want, then use a Live CD and the dd command to copy the data over".

You might even make that a list for convenience. Then we won't waste hours upon hours of time wondering why the stupid "qm resize" and "qemu-resize" commands aren't working in the way you talk about them in your wiki.

I've been a system admin for almost 5 years. If I was confused, new users have no hope whatsoever. Your documentation is what made this situation the stupid time sink it was. Don't even talk about shrinking. Just tell users they cannot do it.
 
  • Like
Reactions: majorgear
FIX YOUR DOCUMENTATION PROXMOX!!!

Why does your wiki talk about shrinking like it is something you can actually do? Why not just put these two damn sentences in it? Why lead us in circles around the "qm resize" commands, or the "qemu-img resize" garbage?
The documentation is correct. Can you provide a link where you see it otherwise?
Else taken from the wiki and docs.
https://pve.proxmox.com/wiki/Resize_disks said:
Shrinking disks is not supported by the PVE API and has to be done manually.
man qm said:
qm resize <vmid> <disk> <size> [OPTIONS]

Extend volume size.

<size>: \+?\d+(\.\d+)?[KMGT]?
The new size. With the + sign the value is added to the actual size of the volume and without it, the value is taken as an absolute one. Shrinking disk size is not supported.

And yes it is possible to reduce a LV.
Why not say, "We're sorry, but you cannot resize your LVM-Thin disk once it is created.
“Whether you think you can, or you think you can’t – you’re right,” -- Henry Ford. See below.
man lvreduce said:
vreduce reduces the size of an LV. The freed logical extents are returned to the VG to be used by other LVs. A copy-on-write snapshot LV can also be reduced if less space is needed to hold COW blocks. Use lvconvert(8) to change the number of data images in a RAID or mirrored LV.

Be careful when reducing an LV's size, because data in the reduced area is lost. Ensure that any file system on the LV is resized before running lvreduce so that the removed extents are not in use by the file system.
And here in the section on the man page of lvreduce it states, that first things have to be done inside. And then you can reduce the LV.
 

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!