Hi!
I have a WinXP guest (host Vista) and I want to shrink the VDI. It has grown strongly because I accidentally produced large files within the guest system. I deleted the files, but, however, the VDI size was not reduced.
How can I shrink the VDI?
Regards
Lilli
[Solved] Shrink VDI size
-
- Volunteer
- Posts: 17798
- Joined: 17. Mar 2008, 13:41
- Primary OS: Debian other
- VBox Version: PUEL
- Guest OSses: Windows XP, Windows 7, Linux
- Location: /dev/random
Re: Shrink VDI size
You can use the VBoxManage modifyhd --compact method, but check the sticky here first. The Clone VDI tool from mpack does a good job. If you don't want to have to register the new VDI, untick the 'New UUID' checkbox, save the file as a new one, rename the original for backup purposes and rename the clone to the original VDI name. VB won't notice the change. If everything works properly with the clone, you can remove the original file.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org
Retired from this Forum since OSSO introduction.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org
Retired from this Forum since OSSO introduction.
-
- Site Moderator
- Posts: 39134
- Joined: 4. Sep 2008, 17:09
- Primary OS: MS Windows 10
- VBox Version: PUEL
- Guest OSses: Mostly XP
Re: Shrink VDI size
Hi Sasquatch: actually, if you just give CloneVDI the same complete (path and tail) filename for both source and destination then the tool does exactly all of that for you. It will initially write the clone to a temp filename, then if (and only if) the cloning process was successful it renames the original file to "Original xyz", and renames the new file to "xyz" (where "xyz" is a placeholder for whatever the original tail name was). If the cloning process fails then the temp file is deleted and your original file remains unaltered. I specifically put this in to save myself from typing (and typos!) - try it!Sasquatch wrote:save the file as a new one, rename the original for backup purposes and rename the clone to the original VDI name.
-
- Volunteer
- Posts: 17798
- Joined: 17. Mar 2008, 13:41
- Primary OS: Debian other
- VBox Version: PUEL
- Guest OSses: Windows XP, Windows 7, Linux
- Location: /dev/random
Re: Shrink VDI size
Hi mpack, I read that in the topic or release notes. I'm sure you took the utmost care to make sure it won't fail. I described these steps in case the user wasn't too sure if it would work properly. I'm sure it will.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org
Retired from this Forum since OSSO introduction.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org
Retired from this Forum since OSSO introduction.
-
- Site Moderator
- Posts: 39134
- Joined: 4. Sep 2008, 17:09
- Primary OS: MS Windows 10
- VBox Version: PUEL
- Guest OSses: Mostly XP
Re: Shrink VDI size
I can fully understand anyones reluctance to do something so obviously crazy as to write to the same file you are reading from. In fact I was busy writing code to detect this case and give the traditional error message, but then I thought... instead of the error, why not just find a way to do what the user wants?! Obviously, given the apparant danger, the feature has been thoroughly tested.Sasquatch wrote:I described these steps in case the user wasn't too sure if it would work properly. I'm sure it will.
For future reference: when you do this it writes the clone to a temp file first. If the cloning process is completed without errors then it renames the original file to "Original <name>", then renames the temp file to <name>. If the cloning process fails then the temp file is deleted and the original is left in the folder untouched. The only thing that can trip me up is if "Original <name>" already existed, meaning I can't do the first rename. In that case you will get an error message, but the clone will be left in the folder with its temp name. You then have to sort out the filenames yourself manually, but the clone itself is good.
-
- Posts: 2
- Joined: 23. Sep 2009, 11:52
- Primary OS: MS Windows Vista
- VBox Version: OSE other
- Guest OSses: MS Windows XP
Re: Shrink VDI size
Thanks to you both!
The shrinking was successful (13GB > 4.5GB).
The shrinking was successful (13GB > 4.5GB).