Proxmox - Resizing VM Disk

Proxmox - Resizing VM Disk

Sometimes virtual machine disks runs out of space. Follow the steps below to resize the its partition.

1) Proxmox Configuration

Select the VM you want to resize the disk in the WebUI and navigate to Hardware>Hard Disk>Disk Action> Resize and set the size increment.

2) VM Configuration

The method to increase the file system will depend on the OS you are running. This tutorial will use an Arch Linux VM.

2.1) Use the tool parted to use the disk.

┬─[minecraft@minecraft:/mineserver]─[15:25:36]
╰─>$ lsblk
NAME   LABEL  SIZE FSSIZE FSUSE% FSUSED FSAVAIL MOUNTPOINTS
                                                       SERIAL      MODEL
sda           100G                                     drive-scsi0 QEMU HARDDISK
├─sda1        512M                              [SWAP]             
└─sda2       99.5G    99G    95%    94G    4.3M /                  
sr0          1024M                                     QM00003     QEMU DVD-ROM
System disks
parted /dev/sda
GNU Parted 3.6
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print                                                            
Model: QEMU QEMU HARDDISK (scsi)
Disk /dev/sda: 215GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End    Size   Type     File system     Flags
 1      1049kB  538MB  537MB  primary  linux-swap(v1)  swap
 2      538MB   107GB  107GB  primary  ext4            boot
Current partitions

2.2) With the command below we will resize the whole partition.

(parted) resizepart 2 100%                                                
Warning: Partition /dev/sda2 is being used. Are you sure you want to continue?
Yes/No? y                                                                 
(parted) print                                                            
Model: QEMU QEMU HARDDISK (scsi)
Disk /dev/sda: 215GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End    Size   Type     File system     Flags
 1      1049kB  538MB  537MB  primary  linux-swap(v1)  swap
 2      538MB   215GB  214GB  primary  ext4            boot
Resizing the OS partition

2.3) Finally, the file system has to be expanded. You can use a live Ubuntu server to boot the VM to and resize using the command below or most of the kernels should support online resizing.

e2fsck /dev/sda2
resize2fs /dev/sda2
┬─[minecraft@minecraft:~]─[16:06:13]
╰─>$ lsblk
NAME   LABEL   SIZE FSSIZE FSUSE% FSUSED FSAVAIL MOUNTPOINTS
                                                        SERIAL      MODEL
sda            200G                                     drive-scsi0 QEMU HARDDISK
├─sda1         512M                              [SWAP]             
└─sda2       199.5G 196.2G    47%  92.5G   93.7G /                  
sr0           1024M                                     QM00003     QEMU DVD-ROM

Resources

6.3. Resizing an Ext4 File System Red Hat Enterprise Linux 6 | Red Hat Customer Portal
Access Red Hat’s knowledge, guidance, and support through your subscription.
Chapter 14. Partition operations with parted Red Hat Enterprise Linux 8 | Red Hat Customer Portal
Access Red Hat’s knowledge, guidance, and support through your subscription.
Chapter 38. Getting started with an ext4 file system Red Hat Enterprise Linux 8 | Red Hat Customer Portal
Access Red Hat’s knowledge, guidance, and support through your subscription.
How to extend an ext4 partition and filesystem?
I have a 400GB disk with a 320GB ext4 partition.I would like to grow the ext4 partition to use the left space (80GB of free space). +--------------------------------+--------+| ext4…