VirtualBox VDI file needs resized (smaller)
VirtualBox VDI file needs resized (smaller)
I've done a ton of searching and tried every method I can find to make my .VDI file smaller.
It's a 80gb Fixed VDI file. I've tried cloning it to a Dynamic and using the 'VBoxManage modifyhd blah.vdi --resize' command and it gives me the following error:
nick:~$ VBoxManage modifyhd Windows7.vdi --resize 40000
Progress state: VBOX_E_NOT_SUPPORTED
VBoxManage: error: Resize hard disk operation for this format is not implemented yet!
Does anyone know of a WORKING method to take a .vdi file and make it sigificantly smaller (from 80gb to 40gb)? The issue is I am only using 25gb of space on this VirtualBox and the remaining space is just chewing up unneeded hard drive space.
I have also tried booting into the VirtualBox (Windows 7) and typing this into run 'diskmgmt.msc' and clicking 'shrink' on the 80gb partition. I then create a new partition with the unused space, format it, delete that just created partition. Then I close completely out of the VirtualBox and try to run the '--compact' command to see if it will work. The compact process completes, however the .vdi file size remains the same.
Any help is appreciated.
It's a 80gb Fixed VDI file. I've tried cloning it to a Dynamic and using the 'VBoxManage modifyhd blah.vdi --resize' command and it gives me the following error:
nick:~$ VBoxManage modifyhd Windows7.vdi --resize 40000
Progress state: VBOX_E_NOT_SUPPORTED
VBoxManage: error: Resize hard disk operation for this format is not implemented yet!
Does anyone know of a WORKING method to take a .vdi file and make it sigificantly smaller (from 80gb to 40gb)? The issue is I am only using 25gb of space on this VirtualBox and the remaining space is just chewing up unneeded hard drive space.
I have also tried booting into the VirtualBox (Windows 7) and typing this into run 'diskmgmt.msc' and clicking 'shrink' on the 80gb partition. I then create a new partition with the unused space, format it, delete that just created partition. Then I close completely out of the VirtualBox and try to run the '--compact' command to see if it will work. The compact process completes, however the .vdi file size remains the same.
Any help is appreciated.
-
Perryg
- Site Moderator
- Posts: 34369
- Joined: 6. Sep 2008, 22:55
- Primary OS: Linux other
- VBox Version: OSE self-compiled
- Guest OSses: *NIX
Re: VirtualBox VDI file needs resized (smaller)
First mistake is deciding to use fixed instead of dynamic.
Fixed can not be manipulated. You can convert it to a dynamic drive with CloneVDI Tool, but you will still have a large file because it can not shrink the partition.
Your next step would be to use gParted to shrink the primary partition ( very dangerous ) and the reported size will still be 80GB but the actual disk space can not grow beyond the partition so it should be smaller. I strongly suggest that you keep the original as a backup until you are sure it is working properly.
Fixed can not be manipulated. You can convert it to a dynamic drive with CloneVDI Tool, but you will still have a large file because it can not shrink the partition.
Your next step would be to use gParted to shrink the primary partition ( very dangerous ) and the reported size will still be 80GB but the actual disk space can not grow beyond the partition so it should be smaller. I strongly suggest that you keep the original as a backup until you are sure it is working properly.
Re: VirtualBox VDI file needs resized (smaller)
Thanks for the reply Perry. Unfortunately I was not the one who created this image in the first place. It was given to me through work and I am forced to either deal with it at 80gb or try to find someway to make it a manageable size.
Is the CloneVDI Tool the same as using:
VBoxManage clonehd OLD.vdi NEW.vdi --variant Standard
If so I already have a clone that is in dynamic drive state.
Is the CloneVDI Tool the same as using:
VBoxManage clonehd OLD.vdi NEW.vdi --variant Standard
If so I already have a clone that is in dynamic drive state.
-
Perryg
- Site Moderator
- Posts: 34369
- Joined: 6. Sep 2008, 22:55
- Primary OS: Linux other
- VBox Version: OSE self-compiled
- Guest OSses: *NIX
Re: VirtualBox VDI file needs resized (smaller)
Not the same but if you have a clone that is not fixed you can skip that part. Download Parted Magic http://partedmagic.com/doku.php?id=downloads and boot the guest to it. free and easy if it does not kill the OS. Shrinking will take a bit but be sure to not shrink it too much or it will not work. Also some formats don't shrink well but you did not mention what that was so I can not advise with that.
Re: VirtualBox VDI file needs resized (smaller)
I will download that tool right now. It's a Windows 7 install. After I use this tool and shrink the partition, will the .vdi file still be reporting 80gb or will it shrink accordingly to the drives configured inside that image?
-
Perryg
- Site Moderator
- Posts: 34369
- Joined: 6. Sep 2008, 22:55
- Primary OS: Linux other
- VBox Version: OSE self-compiled
- Guest OSses: *NIX
Re: VirtualBox VDI file needs resized (smaller)
VirtualBox will report the 80GB IIRC but the partition will be what ever you set it to and can not grow past that. The actual size on drive should not be able to be more than you specified. Now I have to admit that I have only tried this a few times to test to see if it would work so your mileage may vary.
-
mpack
- Site Moderator
- Posts: 39134
- Joined: 4. Sep 2008, 17:09
- Primary OS: MS Windows 10
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Mostly XP
Re: VirtualBox VDI file needs resized (smaller)
Bear in mind that if data was already located on the drive at LBA >N, and you shrink the partition to LBA N, then the data at >N still exists, but now it's inaccessible to the guest filesystem and can't be zeroed. It will survive the cloning and the partition shrinking and everything else. To get rid of it, final pass is to clone the drive with CloneVDI with the compact option enabled. This is after doing everything Perry describes above.
Re: VirtualBox VDI file needs resized (smaller)
Is there a reason you can't make a second VDI (dynamic) attach it to the system and use a normal cloning tool boot disc to clone the old to the new, and then use the new VDI as your disk?
-
mpack
- Site Moderator
- Posts: 39134
- Joined: 4. Sep 2008, 17:09
- Primary OS: MS Windows 10
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Mostly XP
Re: VirtualBox VDI file needs resized (smaller)
I imagine the reason would be common sense. That is, the sense not to use a long and cumbersome procedure when an easier one is available.
Had the procedure you mention been the best choice, we would have mentioned it above.
Had the procedure you mention been the best choice, we would have mentioned it above.
Re: VirtualBox VDI file needs resized (smaller)
The procedure mentioned above though looked like it had drawbacks what I was asking about wouldn't have.mpack wrote:I imagine the reason would be common sense. That is, the sense not to use a long and cumbersome procedure when an easier one is available.
Had the procedure you mention been the best choice, we would have mentioned it above.
Re: VirtualBox VDI file needs resized (smaller)
Hi!
There is a simple solution.
1. Download hirens boot cd (with norton ghost containing). My was 10.6 version.
2. Create VDi with desired size and mount it in Settings of your VMachine
3. Mount and start Hirens CD. Goto to DOS programms and find there Norton Ghost
4. And now create Disk To Disk cloning.
There is a simple solution.
1. Download hirens boot cd (with norton ghost containing). My was 10.6 version.
2. Create VDi with desired size and mount it in Settings of your VMachine
3. Mount and start Hirens CD. Goto to DOS programms and find there Norton Ghost
4. And now create Disk To Disk cloning.
-
mpack
- Site Moderator
- Posts: 39134
- Joined: 4. Sep 2008, 17:09
- Primary OS: MS Windows 10
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Mostly XP
Re: VirtualBox VDI file needs resized (smaller)
Yes, that is the nonsensical solution already mentioned. I don't think anyone really needed a step by step to show just how ludicrous it is. And in any case it's incomplete - it assumes that the partitions will fit on the smaller drive.
A faster and complete procedure: (1) use Gparted to shrink/move partition. (2) Clone and compact with CloneVDI. Total time about 6 minutes (conservative), longer for larger drives (>40GB say). It also has the benefit of being easily reversible and not changing disk UUIDs (if you tick the right CloneVDI option).
A faster and complete procedure: (1) use Gparted to shrink/move partition. (2) Clone and compact with CloneVDI. Total time about 6 minutes (conservative), longer for larger drives (>40GB say). It also has the benefit of being easily reversible and not changing disk UUIDs (if you tick the right CloneVDI option).
Re: VirtualBox VDI file needs resized (smaller)
What do i have to check in CloneVDI to make my 150GB drive display as 55GBin VirtualBox settings? (i resized it to 55GB with GParted but still shown as 150GB )mpack wrote:Yes, that is the nonsensical solution already mentioned. I don't think anyone really needed a step by step to show just how ludicrous it is. And in any case it's incomplete - it assumes that the partitions will fit on the smaller drive.
A faster and complete procedure: (1) use Gparted to shrink/move partition. (2) Clone and compact with CloneVDI. Total time about 6 minutes (conservative), longer for larger drives (>40GB say). It also has the benefit of being easily reversible and not changing disk UUIDs (if you tick the right CloneVDI option).
Tested with cloneVDI:
time taken to make copy of vdi file 17mins
cloneVDI took 20mins to create clone and compact
checkdisk wanted to check drive on startup 4mins
-
mpack
- Site Moderator
- Posts: 39134
- Joined: 4. Sep 2008, 17:09
- Primary OS: MS Windows 10
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Mostly XP
Re: VirtualBox VDI file needs resized (smaller)
You don't. The objective is to reduce and then limit the host disk space used. The logical size of the disk as seen by the guest is not important: if the partition is now smaller than the disk then the guest OS won't fill the disk again.
Re: VirtualBox VDI file needs resized (smaller)
I achieved what i wanted and everything shows like it should be. Thanks for information 