Increase VM Storage ๐พ¶
Expanding your storage of your Debian 12 VM requires resizing both the volume and the filesystem. This guide provides step-by-step instructions.
Prerequisites¶
- Proxmox VE access with permissions to manage VMs.
- VM running Debian 12 (documentation for other OS would be useful later on as well)
- Root or sudo access inside the VM.
- [recommended] Backup your VM or take a Proxmox snapshot.
1. Resize the Volume in Proxmox ๐ ๏ธ¶
Follow these steps to increase the virtual machine's storage volume:
- Turn off the VM.
- Open Proxmox, and select your VM.
- Navigate to Hardware.
- Select Hard Disk.
- Click Disk actions โ Resize.
- Enter the size increment, then click Resize disk.
- Turn on the VM.
2. Resize Storage Within the VM ๐งฉ¶
Once the disk has been resized in Proxmox, additional steps are required inside the VM.
2.1 Modify the Partition Using cfdisk ๐งฑ¶
-
Open
cfdisk:- Run the following command to see the free space allocated.
-
Resize your main storage partition:
- Select your storage partition (take note of the name, e.g. on my case it's
/dev/sda3). - Select Resize (Set it to the TOTAL storage capacity you want, it should default to the max available storage).
- Press Enter.
- Select Write, type
yes, and press Enter. - If you see
The partition table has been altered, the process was successful. - Press q to exit
cfdisk.
- Select your storage partition (take note of the name, e.g. on my case it's
2.2 Resize the Physical Volume (pvresize) ๐ฆ¶
-
Use
pvresizeto expand the partition.Storage Partition Path
Storage partition paths vary; in this guide, we use
/dev/sda3.Templated Command:
Example:
-
Verify the changes:
- The
Free PE / Sizerow should reflect the increased storage.
- The
2.3 Extend the Logical Volume (lvextend) ๐งฎ¶
-
Find your
<lv-path>:- Look for
LV Path, e.g.,/dev/debian-test-vg/root.
- Look for
-
Extend the Logical Volume using
lvextend.Logical Volume Path
Logical Volume paths vary; in this guide, we use
/dev/debian-test-vg/root.Templated Command:
Example:
-
Verify the change:
- The
LV Sizeshould now reflect the increased storage.
- The
2.4 Resize the Root Filesystem ๐งฌ¶
-
Identify the Logical Volume:
- Look for your mounted logical volume, e.g.,
/dev/mapper/debian--test--vg-root.
- Look for your mounted logical volume, e.g.,
-
Resize the root filesystem:
Logical Volume Path
Logical Volume paths vary; in this guide, we use
/dev/mapper/debian--test--vg-root.Templated Command:
Example:
-
Verify the new storage size:
- The available storage should now be increased.
Awwww yeah!
๐ Congratulations! ๐¶
Your Debian 12 VM should now have successfully resized storage! ๐