How to expand the disk of your Hyper-V Quick Create Ubuntu

Today, I ran into an interesting problem when I “just wanted to create some bash scripts”. As usual, something “simple” had to turn into a big ordeal, so today I was confronted with the hard disk of my Ubuntu VM being full. This VM was made in Hyper-V with the Quick Create option, which is very useful. The default disk size? Not so useful, as I found out.

I tried to expand the disk using the “disks” utility but I got a weird error, which told me that the size I was trying to expand it to was smaller than the minimum. That was very much not the case, so as one does I tried it a few more times, to no avail.

However, after some Googling I found the solution to my problem on the Ubuntu Forums.

Steps to follow

  1. In Hyper-V, first stop your virtual machine.
  2. Next, delete any save points you might have created for the VM.
  3. Once your virtual machine is stopped, select the virtual machine and go to “Settings”.
  4. Select your hard disk under the “Hardware” section.
  5. Under the path of the “Virtual hard disk”, click “edit”
  6. Follow the wizard, and choose to expand the hard disk. Choose your new disk size (assuming you have enough room on your host!)
  7. Complete the wizard

Once these steps are followed, start your Ubuntu VM, log in and open your terminal. From there, it’s just a matter of following the instructions.

sudo apt install cloud-guest-utils
sudo parted /dev/sda
(parted) > resizepart 1

When prompted for the disk end, type:

When parted is done, type "quit" to exit

2 thoughts on “How to expand the disk of your Hyper-V Quick Create Ubuntu”

  1. Thanks – but after following your steps – the total disk size reported in df is still only 12 GB even though I requested the partition to be 24 GB. Is there a step missing at the end?

    1. It is important to avoid the control points, there is a control point active the size return to the original size.
      Hope it help.

Comments are closed.

Discover more from PowerUser Guide

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

Continue reading