Decrease size on VM disk, and question about RAW format

Patestismedorgo

New Member
Sep 23, 2021
8
0
1
Hello there,

Been using Proxmox in my spare time, just as a hobby. Currently got a cluster running of 2 servers.
I stupidly increased the disk size of the VM running an Ubuntu environment, where I got all my docker stuff running. It got increased from ~30GB to 2018GB.
I wanted it to settle on 500GB for now. I tried multiple stuff, but can't seem to get it right...

So, basically 2 questions:
1) How can I get the Ubuntu disk to be at 500GB?
2) I see all my VM disks are of type RAW, is this advised? I read something about it better be qcow2?

This is my current config and info I got:
config_ubuntu_disk.JPG
config_raw.JPG
config_storage_types.JPG
config_ubnt_docker.JPG
disk_config.JPG

I'm a software developer, but not familiar with Linux at all. I can follow instructions and tutorials, and trying (slowly) to understand it. So excuses in advance if this seems so trivial for most.
 
1) How can I get the Ubuntu disk to be at 500GB?
You first need to use lvextend to increase your LV size. Then use the partition tool of your choice to increase the size of your partition. Then growfs so your filesystem will make use of the bigger partition size.
But if you don't want a 2TB virtual disk I would fix that first. But you are running ZFS as your VM storage and that is thin provisioned. So its not really a problem to only use 500GB of your 2TB. It wont use 2TB of space. If you only got for example 100GB of data on that virtual disk that virtual disk will only use 100GB of your ZFS pool.
2) I see all my VM disks are of type RAW, is this advised? I read something about it better be qcow2?
No, you run ZFS. So in general you want to use raw and not qcow2.
 
Ok, gotcha.

About the disk size: I understand it's not occupied when it's not used. But for my own sake of mind I would like to just apply whatever it needs and gets. So initially it was at ±30GB, then I increased it in the Proxmox GUI to (by accident) 2018GB, and it seems my Ubuntu guest also sees this.
But I want it to be at 500GB, for Proxmox and the Ubuntu guest.
You are talking about increasing etc, but is that a needed step before shrinking it afterwards?
 
No, I told you to increase the LV, partition and filesystem because your Ubuntu can only use 200GB, not 500GB. So if you want 500GB you would need to increase them from 200 tu 500GB. But if you want to shrink your Zvol from 2018 to 500GB you should do that first.

As far as I know it is not possible to directly shrink a zvol. You would need to create a new 500GB zvol, boot a live linux and move all data from the 2018GB zvol to the new 500GB zvol. Did that once and it really was a pain. Might be faster and easier to just scrap that VM and reinstall it. Or to restore a VM from backup if you got one (and you always should).
 
Last edited:
Totally your own risk (i am not responsible for anything)! Create a fresh backup, before do any resizes!
You already shrinked the partition in the vm-disk to 200G so you can "cut" the raw disk the hard way (never shrink disk to exact or smaller size, than your partition!!).
zfs set volsize=499G local-zfs/vm-101-disk-1
qm rescan --vmid 101
Now the RAW is your desired size -1G, but your guest is not introduced to that size yet. To do so, in Proxmox GUI, VM, Hardware, Disk, Resize, +1G, this wills et the RAW disk to the desiregt size of 500G and introduce the new size to the guest.
When everything went good, grow the guest partition to the new disk size.

edit: If anyone needs that for a Ceph based VM (replace VM-Id/Disk number and Ceph pool name with yours)
qemu-img resize -f raw --shrink rbd:cephfs_data/vm-101-disk-1 215G
qm rescan --vmid 101
 
Last edited:
I inadvertently added a 300GB virtual machine to the Proxmox node. Is it possible to reduce the node's hard disk space to 40GB without compromising its data integrity? Proxmox Version 8.0.3 | VM OS Almalinux 8
 

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!