Score:1

How do I resize a partition running Ubuntu in a VM?

br flag

I'm rephrasing the question here because there are others that answer the question of how to resize an active partition, but perhaps this will help someone running a VM.

I set up a 20.04 VM under Fusion and started compiling something, which failed because it ran out of disk space.

So after resizing the virtual storage of the VM in Fusion, I restarted Ubuntu and went into Disks to expand the root volume into the new free space. But after I was prompted to authenticate for the resize, nothing happened. No error message, but no progress or change either.

So the question is how to resize the active partition in a VM.

enter image description here

Organic Marble avatar
us flag
You cannot operate on a mounted partition.
N0rbert avatar
zw flag
Does this answer your question? [How to resize partitions?](https://askubuntu.com/questions/126153/how-to-resize-partitions)
br flag
Thanks for those replies. Unfortunately I don't know how I'd perform the suggested procedure (which involved booting from a CD) on a VM.
PonJar avatar
in flag
I’m not familiar with Fusion but I’d expect it to be similar to Virtualbox where you would: 1. Add a virtual CD-ROM drive to the machine. 2. Download the GParted iso. 3. Insert the GParted iso into the virtual CD-ROM. 4. Boot the VM telling it to boot from the virtual CD-ROM rather than the hard drive. 5. Use GParted to resize your partitions
br flag
@PonJar Good suggestion, thanks!
br flag
@PonJar I tried that and it appears to have worked fine. I rephrased the question to make it VM-specific, so if you'd like to post your solution I'll mark it as the answer. Thanks!
Nate T avatar
it flag
I see the issue. You can't resize a loaded drive, but, as it is a VM, it is not "there" if it isn't loaded. The way to resize depends on the hppervisor software (i.e. Qemu, KVM, etc.) Most programs that let you create and run VM instances will also let you resize them. This is where you will find your answer.
Score:2
in flag

I’m not familiar with Fusion but I’d expect it to be similar to Virtualbox where you would:

  1. Add a virtual CD-ROM drive to the machine.
  2. Download the GParted iso.
  3. Insert the GParted iso into the virtual CD-ROM.
  4. Boot the VM telling it to boot from the virtual CD-ROM rather than the hard drive.
  5. Use GParted to resize your partitions
Nate T avatar
it flag
Sry, I didn't notice that you posted an answer, or I would have waited until yours was accepted before posting. I think I may have loaded the page just before you posted. Or maybe I'm just blind. Either way, just know that it wasn't intentional. @OP accept this answer if you accept any.
PonJar avatar
in flag
@NateT No problem. As I said I’m not familiar with Fusion and I would say your answer is probably the better and quicker solution so it adds value.
Score:2
it flag

As I said in my comment, you will need to do this inside of the hypervisor program on which the VM runs. Below, I have included instructions on how to do it in fusion (taken from the VMWare website):

  • Open Fusion.
  • Select the virtual machine in the Virtual Machine Library.
  • Go to Virtual Machine > Settings....
  • Click Hard Disk(s).
  • Use the slider to adjust the size of the virtual disk.
  • Click Apply.
br flag
Thanks for the reply; it's useful to inform people of the first step. But as I mentioned in the post, I had already resized the virtual disk. You still need to resize the boot partition to fill the added space, and this can't be done by Ubuntu's "Disks" utility. So after doing what you suggest, one must also use PonJar's procedure.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.