How to use the command 'qm disk resize' (with examples)
This article provides examples of how to use the ‘qm disk resize’ command in the Proxmox Virtual Environment (PVE) to resize a virtual machine disk.
Description
The ‘qm disk resize’ command is used to resize a virtual disk of a specific virtual machine in Proxmox Virtual Environment (PVE). By specifying the virtual machine ID, disk name, and the size to be added or subtracted, this command allows users to easily resize virtual disks for their virtual machines.
Use case 1: Add ’n’ gigabytes to a virtual disk
Code:
qm disk resize vm_id disk_name +nG
Motivation: The motivation for using this command is to increase the size of a virtual disk in order to provide more storage space for a virtual machine. This can be useful when running out of disk space and needing to accommodate additional data or applications.
Explanation:
- ‘qm disk resize’ is the command to resize a virtual machine disk.
- ‘vm_id’ refers to the ID of the virtual machine for which the disk needs to be resized.
- ‘disk_name’ specifies the name of the disk within the virtual machine that needs resizing.
- ‘+nG’ represents the amount of gigabytes to be added to the disk size. The ‘+’ sign indicates addition, while ’n’ represents the numeric value of additional gigabytes.
Example output:
Resizing disk of virtual machine '123' with disk name 'vm_disk' by 10GB.
Disk resize completed successfully.
Use case 2: Subtract ’n’ gigabytes from a virtual disk
Code:
qm disk resize vm_id disk_name -nG
Motivation: The motivation for using this command is to decrease the size of a virtual disk in order to free up storage space or optimize resource utilization. This can be necessary when a virtual machine no longer requires as much storage capacity.
Explanation:
- ‘qm disk resize’ is the command to resize a virtual machine disk.
- ‘vm_id’ refers to the ID of the virtual machine for which the disk needs to be resized.
- ‘disk_name’ specifies the name of the disk within the virtual machine that needs resizing.
- ‘-nG’ represents the amount of gigabytes to be subtracted from the disk size. The ‘-’ sign indicates subtraction, while ’n’ represents the numeric value of the gigabytes to be removed.
Example output:
Resizing disk of virtual machine '123' with disk name 'vm_disk' by -5GB.
Disk resize completed successfully.
Conclusion
The ‘qm disk resize’ command in Proxmox Virtual Environment (PVE) is a powerful tool that allows users to easily resize virtual machine disks. By following the provided examples, users can increase or decrease virtual disk sizes as per their requirements, thereby optimizing storage space and improving resource allocation.