shrinking partition in Windows then logical volume accordingly

lethargos

Well-Known Member
Jun 10, 2017
142
6
58
74
If I make a lv bigger, then it's easy to also make it bigger in the vm (Windows Server 2016) with disk management. Windows will make use of all the available space and that's that. But if I do it the other way around and shirnk the partition within the vm and then reduce the lv, I won't be able to do it accurately, because I won't know exactly how much I can delete from the lv. So is there a way to do this? Could lvm be aware of the actual unused space after shrinking?

(I run proxmox 4.4-1)
 
LVM cannot know how is the real size of the filesystems because it doesn't know about filesystems, it just knows about bytes area on the hard disk which are grouped and associated to a logical name.

But you could set a target size inside the VM ( resizing from 140 to 120 GB for instance), make sure that the partition table has been resized inside the VM ( I don't know if/how Windows does update the partition table when resizing a NTFS volume) and then on the host resize the Logical Volume to 120GB with the lvresize command.

This is potentially a dangerous operation, I assume you know what you're doing.
 
When I reduce the size of the lv (using lvm tools), the information is not updated either in the vm, or in the proxmox interface. Is there any way I can force a refresh (at least in the proxmox interface)?

The only way I can refresh the proxmox information is to add a random amount of GB to the disk size and then it will start showing the correct information, which is not too orthodox a method :)
 
Last edited:
there is the more orthodox method of calling on the command line
qm rescan -vmid <VMID>

to update the disk size info :)

NB: I guess you understood by now that the size displayed is informative only
 
Well, it depends what you mean by that, but as it is, I wouldn't agree. If I change the size using lvresize, the vm isn't aware of any changes. Whereas, if I change it in the proxmox interface (of course, I can only increment in this case), the vm (Windows Server) sees the change in disk management and shows the unallocated space. In my opinion, that's more than simply informative, right? Or maybe I'm not seeing things correctly :)

Anyway, yes, it does work instantly. But I see your point, I should rely on the cli, at least in specific contexts - which I prefer to, anyway.

To sum it all, am I correct in saying that I cannot decrease the hard disk size live, but only increase it? (at least as far as Windows is concerned)
 
Well, it depends what you mean by that, but as it is, I wouldn't agree. If I change the size using lvresize, the vm isn't aware of any changes. Whereas, if I change it in the proxmox interface (of course, I can only increment in this case), the vm (Windows Server) sees the change in disk management and shows the unallocated space. In my opinion, that's more than simply informative, right? Or maybe I'm not seeing things correctly :)

Anyway, yes, it does work instantly. But I see your point, I should rely on the cli, at least in specific contexts - which I prefer to, anyway.

To sum it all, am I correct in saying that I cannot decrease the hard disk size live, but only increase it? (at least as far as Windows is concerned)

PVE tells Qemu that the block device has a new size ("block_resize DEVICE 0" via the Qemu monitor), you can do the same after you have manually resized the LV. The reason we don't allow size reductions is that you can lose data.
 
  • Like
Reactions: lethargos
Thanks. I appreciate your quick replies. It think it really encourages people to use and buy proxmox, knowing that they can get help if something goes wrong.
 

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!