Page 1 of 1

Is there a way to make virtual HD smaller?

Posted: 5. Jun 2014, 11:31
by bamim2
I have a VHD that I made from a physical HD using disk2vhd.exe from SysInternals. If you haven't check this guy's work out, you REALLY need to. The physical HD I used was 1TB, but I had partitioned it to 130GB (boot)/30GB/780GB. The virtual drive I made came out partitioned as Dynamically Allocated. It's now, 104GB actual size, but 930GB virtual. I would like to know if anyone knows how I can shrink the virtual drive down about 150GB without losing the data of course?

Re: Is there a way to make virtual HD smaller?

Posted: 6. Jun 2014, 08:19
by Jeff_59
Hello Bamim2,

Can you please tell us why you need to shrink the virtual drive size. Also, i don't know if it will help you,
but did you try CloneVDI (Mpack software)?

Let us know. Thanks

Regards,

Jeff_59

Re: Is there a way to make virtual HD smaller?

Posted: 6. Jun 2014, 12:22
by mpack
You can't reduce drive capacities with CloneVDI - or with VBoxManage for that matter.

What you should do is use a GParted live CD to shrink and move the partitions. Then compact the disk with CloneVDI. This will not reduce the drive capacity, but it will reduce the host disk space the drive currently occupies, and the fact that the partitions are smaller will ensure that the unpartitioned spaces won't be used again.

It's awkward that you split the drive into the three partitions. That may make resizing them tricky and slow - you'll have to see.

Re: Is there a way to make virtual HD smaller?

Posted: 6. Jun 2014, 14:05
by bamim2
I've used your software (which is VERY nice, by the way THANK YOU) on other virtual drives to make them larger & it's simple to use & worked great. That said, I looked at your software to shrink this drive, but found that it didn't have that capability.

To Compact the drive, do I just basically run the drive through the "Compact drive while copying" feature? I wasn't sure if that would actually do anything more than say, "defrag" or something. Since you're kind enough to respond to my question, does your 'Compacting' feature do something different than "defrag"? Would defragmenting the drive help?

My VD has 2 empty partitions that I can easily make into one that's about 900GB. The partition with stuff on it is 100GB & it's 45% free. So, if I use GParted to shrink the partition from 100GB down to about 80GB, that should be big enough. Do I just use GParted while the Virtual drive is up & running in VB, just like it was on a regular HDD?

Thank you both for your help & knowledge. I greatly appreciate it.

Re: Is there a way to make virtual HD smaller?

Posted: 6. Jun 2014, 14:52
by mpack
"Compact" eliminates host disk space assigned to data which the guest filesystem regards as deleted. VirtualBox can't do this automatically because it works at a hardware level, whereas this feature requires knowledge of the guest filesystem, i.e. a software feature. For this reason only selected guest filesystems are supported, namely FATx, NTFS and EXTx. Plus, if VirtualBox did this automatically then undelete would be impossible inside a guest.

The compaction feature has nothing to do with defrag. CloneVDI will defrag the image block order regardless of any settings.

You should adjust the partition sizes as I described earlier, and only then create a compacted clone using CloneVDI.

Re: Is there a way to make virtual HD smaller?

Posted: 6. Jun 2014, 15:05
by bamim2
Thank you. I'll do that.

[Solved] Re: Is there a way to make virtual HD smaller?

Posted: 7. Jun 2014, 13:10
by bamim2
Just wanted to add a note here to say thank you again & in the event that anyone looks at this in the future. I did what you said & after using GPartEd & cloning & compacting my drive, it's about 14GB smaller than it was. As seen by the Host OS.