Shrink a Virtual Hard drive

Discussions related to using VirtualBox on Windows hosts.
Post Reply
Watson221
Posts: 2
Joined: 27. Aug 2020, 21:00

Shrink a Virtual Hard drive

Post by Watson221 »

Hi everyone!
I'm having an issue resizing my Ubuntu machine's hard drive. My original goal was to increase the Virtual machine's actual size from 10 gb to 35 gb. I have a dynamically allocated Ubuntu virtual machine. I started out with 10 gb and I tried to enlarge it by going to File> Virtual Media Manager I then accidentally typed in 110gb as the size and clicked ok. Now I can't shrink the virtual hard drive size down to 35gb and I'm still not sure how to sync the virtual size with the actual size of my vm.
Thanks!
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, Linux

Re: Shrink a Virtual Hard drive

Post by scottgus1 »

Once you increase the virtual disk max size you can't shrink it again. However, you can control how much the dynamic disk fills up the new available space with the partition size inside the guest OS. You must edit the partition size inside the guest OS to use the new space you wanted to have anyway.

Use an in-the-guest partition editor to increase the partition to 35GB. The guest disk file won't get any bigger.
Watson221
Posts: 2
Joined: 27. Aug 2020, 21:00

Re: Shrink a Virtual Hard drive

Post by Watson221 »

Hi Scottgus1, I'm not seeing a partition appear in disk manager on Windows. I'm not sure how I can access that partition and edit it. Could you break it down for me?
Thanks,
John
BillG
Volunteer
Posts: 5106
Joined: 19. Sep 2009, 04:44
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows 10,7 and earlier
Location: Sydney, Australia

Re: Shrink a Virtual Hard drive

Post by BillG »

That really has nothing whatever to do with VirtualBox. It is a Windows problem. If you cannot fix it using the built-in tools in Windows (such as Disk Manager or diskpart) you will need to use a third-party partition manager. Search for Windows partition tools - you will get millions of hits!
Bill
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, Linux

Re: Shrink a Virtual Hard drive

Post by scottgus1 »

As Bill says, the methods of editing the partition inside the guest OS are not in the scope of the Virtualbox forum. We basically help you get the guest OS going. What you need to do inside the guest OS is something you'd need to websearch for, using the guest OS's help channels. You would need to ask Ubuntu's forums about how to edit the partitions inside Ubuntu. (Hint, Gparted is a common bootable ISO that can change partitions. Recommendation, back up the guest if you have data or setups you would cry over if you lost.)
Post Reply