Add capacity to disk from Proxmox
- Add disk capacity to VM from Proxmox GUI
- Click on the VM
- Click on the hardware tab
- Click on the disk you wish to increase
- Click on the disk action dropdown
- Click on Resize
Input the amount of EXTRA disk space you want added to the VM (NOT the total disk space)
From terminal/console on the VM
Run the following commands
lsblk
You’ll see a list of available disks, most likely something to the effect of /dev/sda or /dev/sdb
parted /dev/sda
print
If presented with the following:
Warning: Not all of the space available to /dev/vda appears to be used, you can fix the GPT to use all of the space (an extra 268435456 blocks) or continue with the current setting? Fix/Ignore? Simply press "F" and enter
You will see a list of partitions with numbers 1, 2, 3 etc. Run the following command to resize the appropriate partition:
resizepart 1 100%
Replace number 1 with the appropriate partition according to your setup.
quit
Resize with or without LVM
The final steps involves actually resizing the disk space available on the partition to use all the disk space. You will however need to determine whether you’re using LVM or not. Simply run this command to check if you’re using LVM:
lvdisplay
If you see a list of logical volumes, you’re using LVM. If you see command not found, you’re not using LVM.
Commands to run WITH LVM
lsblk
You’ll see something to the effect of /dev/sda1 or /dev/sdb1 etc.
pvresize /dev/sda1
Be sure to use your partition here and not the whole disk (use sda1 or sdb1 etc, and not sda or sdb)
df -h
From this command you’ll see something similar to the following:
- /dev/mapper/centos-home
- /dev/mapper/centos-root
From the lsblk command above you’ll see the disk space of the above paths. You can then increase the available space to /dev/mapper/centos-home as an example:
lvresize --extents +100%FREE --resizefs /dev/mapper/centos-home
Commands to run WITHOUT LVM
resize2fs /dev/sda1