Resize Ubuntu Disk on Proxmox

2024-06-10 / 2 min read
Last updated: 2024-06-11

Guides


Proxmox

  1. Resize the hard drive on the target machine

Resize HD for VM in Disk Action

  1. Specify how much to extend the drive by, not the new drive size!

Disk resize

New disk size, extended by 30 GB

  1. Click Resize disk

Partition mgmt the Ubuntu VM

  1. Enter superuser mode sudo su

  2. Run fdisk -l to see the existing partition. We want to identify the main one.

Output:

Device      Start      End  Sectors  Size Type
/dev/sda1  227328 71720926 71493599 34.1G Linux filesystem
/dev/sda14   2048    10239     8192    4M BIOS boot
/dev/sda15  10240   227327   217088  106M EFI System

Looking at above /dev/sda1 is the partition we want.

  1. Run the parted command with the partition in question parted [PARTITION IN QUESTION] ex: parted /dev/sda1

Output:

root@k8s-02:/home/serveradmin# parted /dev/sda1
GNU Parted 3.4
Using /dev/sda1
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted)
  1. Run print in the (parted) menu
(parted) print
Model: Unknown (unknown)
Disk /dev/sda1: 36.6GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags:

Number  Start  End     Size    File system  Flags
 1      0.00B  36.6GB  36.6GB  ext4
  1. Resize the partition 1 as indicated above with resizepart 1

  2. Type Yes

(parted) resizepart 1
Warning: Partition /dev/sda1 is being used. Are you sure you want to continue?
Yes/No?
  1. Type 100% End? [36.6GB]? 100%

  2. Type quit

  3. Now we need to resize the file system resize2fs /dev/sda1

  4. Check to see if it works: df -h