This guide will teach you how to resize a hard drive in Proxmox virtual machines. This can be useful if you need to add more storage space to your VM or if you need to shrink the size of your VM’s hard drive.

Prerequisites

Before you begin, you will need to have the following:

  • A Proxmox server with at least one virtual machine
  • A backup of your VM’s data

Step 1: Clone Your VM 

It is always a good idea to create a backup of your VM before you make any changes to it. This way, if something goes wrong, you can restore your VM to its original state.

To clone your VM, follow these steps:

  1. Log in to your Proxmox server.
  2. Click on the Virtual Machines tab.
  3. Select the VM that you want to clone.
  4. Click on the Clone button.
  5. Enter a name for the cloned VM.
  6. Click on the Clone button.

Step 2: Resize the Hard Drive

Once you have cloned your VM, you can resize the hard drive.

To resize the hard drive, follow these steps:

  1. Log in to your Proxmox server.
  2. Click on the Virtual Machines tab.
  3. Select the VM that you want to resize.
  4. Click on the Hardware tab.
  5. Click on the Disks tab.
  6. Select the hard drive that you want to resize.
  7. Enter the new size of the hard drive in gigabytes.
  8. Click on the Apply button.

resize disk resize disk

Step 3: Resize the Partition

Once you have resized the hard drive, you need to resize the partition.

To resize the partition, follow these steps:

  1. Boot your VM into the operating system that is installed on the hard drive.
  2. Open a terminal window.
  3. Type the following command:
parted /dev/sda
  1. Type the following command to view the current partition table:

print

fdisk

fdisk mount

  1. Type the following command to resize the partition:
resizepart 3 100%
  1. Type the following command to save the partition table changes:
quit

Step 4: Resize the File System

Once you have resized the partition, you need to resize the file system.

To resize the file system, follow these steps:

  1. Boot your VM into the operating system that is installed on the hard drive.
  2. Open a terminal window.
  3. Type the following command to determine the filesystem type:
df -h
  1. Type the following command to resize the file system:
lvresize --extents +100%FREE --resizefs /dev/mapper/ubuntu--vg-ubuntu--lv

Step 5: Verify the Changes

Once you have completed all of the steps, you can verify the changes by typing the following command:

df -h

The output of this command should show the new size of the hard drive.


Discover more from Susiloharjo

Subscribe to get the latest posts sent to your email.

Discover more from Susiloharjo

Subscribe now to keep reading and get access to the full archive.

Continue reading