Home VM Tips How to Decrease Disk Size in Proxmox?

How to Decrease Disk Size in Proxmox?

2024-04-11 | Iris Lee

Table of contents
  • Why need to decrease disk size?
  • How to decrease disk size?
  • Backup Proxmox VM with Vinchin solution
  • Proxmox resize disk FAQs
  • Conclusion
Are you looking for a robust Proxmox backup solution? Try Vinchin Backup & Recovery!↘ Download Free Trial

Proxmox VE is an open-source server virtualization management platform that combines two virtualization technologies: KVM for virtual machines and LXC for lightweight OS-level virtualization. It offers a web-based interface for easy management of VMs and containers, high availability, live migration, and advanced networking features. Proxmox also supports various storage options, including local and network-attached storage, and comes with built-in tools for backup and recovery. Designed for enterprise use, Proxmox enables efficient management of virtualized server resources, making it a popular choice for data centers and IT professionals.

Why need to decrease disk size?

There are several reasons why an administrator might need to decrease the size of a disk in a virtual environment like Proxmox:

1. Over-Provisioning: Sometimes, a virtual disk might be over-provisioned with more storage than what is actually needed. Reducing the disk size can reclaim space and allow for more efficient utilization of physical storage resources.

2. Performance Optimization: Larger disks can sometimes lead to longer backup times and can be less efficient in terms of I/O performance. By keeping disks sized closely to the actual data usage, performance and backup times can be optimized.

3. Cost Management: In a cloud environment, or when using SAN/NAS storage, you might be paying for the provisioned storage. Decreasing the size of a disk can reduce costs.

4. Migration Requirements: If you need to migrate a VM to a new host or platform that has less storage available, you may need to reduce the size of the VM’s disks to fit into the new environment.

5. Disk Type Conversion: When converting between disk formats (for example, from thick-provisioned to thin-provisioned), it might be necessary to adjust the disk size to suit the capabilities or requirements of the new format.

How to decrease disk size?

Since it is not straightforward and there is a good chance of data loss, there is no option to shrink a disk from the Proxmox web interface.

If your Proxmox virtual machine uses LVM, you can indeed reduce disk space by resizing the file system and shrinking the logical volume and physical volume. Here are the specific steps:

1. Back up the virtual machine

Back up virtual machines in Proxmox. This is the most important step in case anything goes wrong.

2. Check disk usage

Log in to the virtual machine and check the file system usage to make sure there is enough space to shrink.

3. Shrink the file system

Shrink the file system inside the virtual machine. For Linux systems, if it is an “ext4” file system, use the “resize2fs” command.

sudo resize2fs /dev/mapper/vgname-lvname 20G

Here “vgname” is the volume group name, and “lvname” is the logical volume name. “20G” is the size you want to shrink to.

4. Shrink the logical volume

In the virtual machine or from Proxmox’s rescue mode, use the “lvreduce” command to shrink the logical volume.

sudo lvreduce -L 20G /dev/mapper/vgname-lvname

Here “-L 20G” specifies the new logical volume size.

5. Rescan the physical volume

If you also need to resize the physical volume, you can use the “pvresize” command. But usually, if you just shrink the logical volume, there is no need to resize the physical volume. You can update the disk size in the node using the following command:

qm rescan

Finally, restart the virtual machine and check that the file system and disk space are adjusted correctly.

Backup Proxmox VM with Vinchin solution

It’s important to note that decreasing disk size is usually more complex and riskier than increasing it. Therefore, it’s often only done when necessary, and with proper precautions like backing up the data and ensuring that the file system and partitions within the disk are properly resized before shrinking the virtual disk itself.

Vinchin Backup & Recovery offers a comprehensive suite of advanced features to safeguard Proxmox VE environments, ensuring data security and integrity through adherence to the 3-2-1 backup rule.

Its capabilities include automated VM backups, agentless backup and LAN-Free options, as well as offsite copy for robust disaster recovery. Instant recovery and efficient data reduction techniques, alongside cloud archiving options, further enhance data management. Additionally, the solution incorporates data encryption and ransomware protection mechanisms for an extra layer of security. It also facilitates seamless V2V migration between supported virtual platforms, ensuring flexibility and ease of data transfer.

It only takes 4 steps for you to backup Proxmox VE VMs:

1. Select the backup object.

Select the backup object

2. Select backup destination.

Select backup destination

3. Select backup strategies.

Select backup strategies

4. Review and submit the job.

Review and submit the job

Thousands of companies globally have already adopted Vinchin Backup & Recovery for their data protection needs. You can begin exploring its extensive capabilities with a comprehensive 60-day trial, fully equipped with all features. Contact us with the details of your Proxmox VE setup, and you will receive a customized solution that fits seamlessly with your IT landscape.

Proxmox resize disk FAQs

1. Q: How to increase disk size in Proxmox?

A: You can increase disk size through Proxmox web interface: just select the VM > Hardware > Hard Disk > Disk Action > Resize, and enter the size you want to increase.

Or, you can use tools like qm resize <VMID> <DISKID> <newsize> in the Proxmox command line interface to resize the disk.

2. Q: What happens if I resize a disk larger than the available storage space in Proxmox?

A: If you attempt to resize a disk to a size larger than the available storage space in Proxmox, the operation will fail. Make sure you have enough free space on the storage device before resizing the disk.

Conclusion

Proxmox VE is a versatile open-source platform for managing virtual machines and containers, offering a user-friendly web interface and enterprise-grade features. Decreasing disk size is occasionally necessary for resource optimization, cost reduction, or to meet specific storage constraints. While Proxmox does not provide a direct way to shrink disks due to potential data loss risks, the process involves backing up the VM, reducing the file system and logical volume sizes within the VM. This procedure is complex and must be handled with caution to prevent data loss.

Share on:

Categories: VM Tips
You May Also Like...