Page 1 of 1

Shrink a Virtual Hard drive

Posted: 27. Aug 2020, 21:25
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!

Re: Shrink a Virtual Hard drive

Posted: 27. Aug 2020, 22:06
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.

Re: Shrink a Virtual Hard drive

Posted: 27. Aug 2020, 23:58
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

Re: Shrink a Virtual Hard drive

Posted: 28. Aug 2020, 01:26
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!

Re: Shrink a Virtual Hard drive

Posted: 28. Aug 2020, 19:15
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.)