Score:0

Unable to resize partition in Ubuntu VM

gp flag

Original Q: I have increased my .vdi size within the control panel of my VM. Now the Virtual Size is 100gb and the Actual Size is 21.73gb.

I tried another answer to run the .iso boot disk and resize the partition within the 'Try Install' version of the disk. But the option is grayed out. In that Answer they stated to start with the top partition box and then resize the bottom partition box but mine are side by side.

Update #1: I loaded an .iso and ran GParted and it allowed me to resize Partition 3 (which was the 21.73gb partition) and increase Partition 3 to 100gb. Next, I booted up the VM and can see within Disks that Partition 3 is 100gb. However, when I try to move files, it still tells me that I am short of space. What is the next step from here?

ar flag
Does this answer your question? [Resize VirtualBox Ubuntu](https://askubuntu.com/questions/879262/resize-virtualbox-ubuntu)
linuxuser24569 avatar
gp flag
I was in the process of trying the steps listed in this Answer when I tried GParted and it allowed the Partition to be resized. I just need to figure out why I cant use the extra space thats shown within the Partition. Because I think I have made progress thats beyond the scope of that Answer, I won't attempt it. Or do you think my update is still relevant to that Answer?
ar flag
I am retracting the close vote in light of your update and comment.
Score:0
gp flag

I have found the answer on another post but will post it with numbered steps to close out my request for help with this. In VirtualBox 7.0 the partition I am trying to increase is called: /dev/mapper/vgubuntu-root

In the other post it was called something similar, but different. So, although the answer is out there, I hope I am providing a more updated version.

RESIZE .VDI VM HARDDISKS

  1. Make sure VM is Powered OFF
  2. Go to 'Tools' within the VM Control Panel, select VM and increase slider to desired storage Gb
  3. Select VM and go to Settings (can also right click on the VM to access Settings)
  4. Go to Storage and click the CD (Empty)
  5. On the right side of the screen, click the CD icon, select 'Choose a disk file...' and locate your Ubuntu_22.04.iso file

If you don't have an Ubuntu 22.04 ISO, download it here: https://ubuntu.com/download/desktop

  1. Make sure the Controller:IDE (the one with the Ubuntu.iso) is above Controller:SATA (this boots the .iso instead of the .vdi)
  2. Boot VM with Ubuntu 22.04.iso, and select 'Try Ubuntu'
  3. Open Terminal, type: gparted
  4. Increase dev/mapper/vgubuntu-root to max (the Gb you set in Step #3)
  5. Power OFF VM
  6. Reboot without .iso (normal reboot)
  7. Open Terminal, type: sudo lvresize -L xx.xxG /dev/mapper/vgubuntu-root

NOTE: xx.xx are placeholders for numbers

  1. If states: Insufficient free space: xxxx extents needed, but only xxx available, lower number in xx.xxG - Start with number lower than the increased Gb number (for example, if you increased the Gb to 50gb, start with 40.00gb in the command)
  2. Next, type: sudo resize2fs /dev/mapper/vgubuntu-root 100000000
  3. Prompt will indicate that number is too large and will give you the max number. If it doesn't add a zero or two.
  4. Re-paste command with new max. number: sudo resize2fs /dev/mapper/vgubuntu-root 15073280 (<-- in my case increasing my .vdi to 60gb it was this number)
  5. Verify dev/mapper/vgubuntu-root has been increased. In terminal, type: df -h
  6. View results: dev/mapper/vgubuntu-root -- 57G (size) -- 14G (used) -- 41G (available) ...

You can start if [df -h] in terminal before Step #11 to verify the .vdi size before increasing it.

Done.

I sit in a Tesla and translated this thread with Ai:

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.