How to delete an empty partition.

Discussions related to using VirtualBox on Windows hosts.

How to delete an empty partition.

Postby evzen » 9. Dec 2018, 21:37

Hello, I had a 138 GB partition and after deleting the files, removing old programs and clearing Windows I have 85GB now. I would like to leave 2GB as free space and remove the rest of the empty space and reduce the VHD file size from 138 GB to 87-90 GB. First partition Windows (85GB used and 2GB free), second partition is empty.
I tried to change VHD to VDI by "modifyhd" with "--compact" parameter, unfortunately did not help. Then I tried "modifyhd" with the parameter "--resize 90000", it did not help.
Please advise me how to delete an empty section and reduce VHD?
Thank you.
evzen
 
Posts: 1
Joined: 9. Dec 2018, 21:23

Re: How to delete an empty partition.

Postby WFV » 10. Dec 2018, 01:19

You really haven't posted enough information here. Do you mean you have a Windows Guest in a Windows Host that was 138GB that you did some cleanup on and now want to shrink the partition?
If so you can shrink the partition using the built-in Windows diskmanager, or with software like Parted-Magic or Partition-Wizard in the guest however, shrinking the VDI itself is a whole different subject and iirc can't be done.
See resizing a vdi. I had similar issue some time back so had to uninstall the Guest OS (Windows7 pro64) and there are a couple of things that must be done in Windows (the guest) before uninstalling to make sure you can reuse the license to reinstall it. Then I deleted the guest in VirtualBox (and all remnants of it in the Host afterwards), then created a new guest to the desired size and re-installed Windows.
So you probably want to back up the guest before doing anything now (not snapshot, but a full copy of the guest in the Windows Host), also save any data (pics, docs, vids, etc) somewhere outside the Guest before uninstalling/deleting it.
WFV
 
Posts: 65
Joined: 7. Mar 2016, 13:28
Primary OS: Linux other
VBox Version: OSE other
Guest OSses: ArchLinux; Fedora; Ubuntu; Win7pro64; WinXP

Re: How to delete an empty partition.

Postby mpack » 10. Dec 2018, 10:46

You have not mentioned snapshots or linked cloned. Hopefully that is because neither is being used because what you are trying to do would destroy the VM in those cases.

First, use disk manager in the guest to reduce the system partition to the desired size. This tells Windows that you only want to use that portion of the drive.

Next, clone the VHD using the CloneVDI tool. Make sure to enable the "Keep UUID" and "Compact" options. I suggest that you not delete the VHD right away, though you can move it elsewhere.

CloneVDI will have created a smaller VDI. Do the normal manipulations to remove and unregister the old VHD (important, or you'll have a UUID clash), and add the new VDI.
mpack
Site Moderator
 
Posts: 29601
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP


Return to VirtualBox on Windows Hosts

Who is online

Users browsing this forum: No registered users and 26 guests