How to shrink a drive

Zotty

New Member
Feb 22, 2021
10
0
1
22
I accidentally resized a drive to big on a vm because i meant to make the vm size 575gbs but accidentally added 575 instead so how would I go about shrinking that because my LVM doesnt have that much storage
 

leesteken

Famous Member
May 31, 2020
2,627
569
118
Easiest would be to restore from backup.
If you already expanded the filesystem inside the VM to match the new size, please find a guide (in this forum or on the internet) for reducing the size of your filesystem. Then look for a LVM guide somewhere to reduce the size of a logical volume (LV).
Afterwards, change the VM configuration file in /etc/pve/qemu-server/ to match the actual size, or find the qm command that does that for you in the Proxmox manual.
EDIT: Alternatively, add a new smaller virtual disk and copy everything yourself (and make the disk bootable, if need be) and afterwards remove the old disk.
 
Last edited:

titust11

Member
Nov 18, 2021
48
2
8
63
Easiest would be to restore from backup.
If you already expanded the filesystem inside the VM to match the new size, please find a guide (in this forum or on the internet) for reducing the size of your filesystem. Then look for a LVM guide somewhere to reduce the size of a logical volume (LV).
Afterwards, change the VM configuration file in /etc/pve/qemu-server/ to match the actual size, or find the qm command that does that for you in the Proxmox manual.
EDIT: Alternatively, add a new smaller virtual disk and copy everything yourself (and make the disk bootable, if need be) and afterwards remove the old disk.
Hi famous member, What if the disk that I want to shrink is not the VM disk, but disk attached to a VM, this disk is not yet used, it's just empty. By mistake I grew it instead of shrinking it. And BTW why the option RESIZE DISK offers just to grow and not shrink.
Don't tell me that I have to delete the large disk and create a smaller one it the only solution.....
There should be a shrink disk option when the stored data allows it in terms of space
 

bbgeek17

Famous Member
Nov 20, 2020
1,296
264
88
Blockbridge
www.blockbridge.com
Shrinking a disk is an operation that can lead to much pain if done incorrectly...

You have not specified what type of disk you have and your definition of "empty" is not clear. Does it have a partition? filesystem? If it does - the filesystem knows about the disk size, things sometimes are written to the end of the disk for safekeeping.

PVE has no understanding of what data is on the disk : filesystem? another volume manager? something more complex?
Some of the above allow for underlying device to be shrunk, others do not. You must start with File System, sometimes continue with Partition, then perhaps a volume manager and only then, may be, a disk.
So this is an advanced operation that cant be executed with a click of a button.

And if the disk is empty why not just delete it and create the one you want?



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

titust11

Member
Nov 18, 2021
48
2
8
63
You have not specified what type of disk you have and your definition of "empty" is not clear
It’s simply a virtio disk that I attached as a secondary disk to a Openmediavault VM.
I just created the vdisk by specifying the size and clicking add. The VM was still turned off, so the disk was virgin, no formatting, no data written by the VM OS, no partitioning etc. So there was nothing what you are talking about On the disk.
Then I realized that the disk was too large, and I wanted to shrink it by 1TB. There was no way…. It doesn’t make sense. I could only grow it.
Vmware converter allows you to do expanding, thinning and shrinking.
But maybe this is because virtio disks are considered block devices? I don’t know.
In the end this is what I did. I deleted the disk and recreated it.
 

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 your own in 60 seconds.

Buy now!