Reducing VirtualBox VDI logical size

5,589

Unfortunately, I don't think there is a single VBoxManage command you can use to "shrink" the reported total physical size ("logical" as you say) of your virtual disk. Your best bet is going to be to create a new, second disk of the appropriate size, and use a disk cloning tool like CloneZilla to copy the data from the partition(s) on the first drive to your new disk.

Of course, if you are resizing the disk - that probably means it is a dynamic disk and it typically doesn't matter what the total size is - just allow the partition(s) inside the disk to be appropriately sized.

Share:
5,589

Related videos on Youtube

Erick Petrucelli
Author by

Erick Petrucelli

Updated on September 18, 2022

Comments

  • Erick Petrucelli
    Erick Petrucelli over 1 year

    I was going to increase one of my VDI to 80 GB with the command:

    VBoxManage modifyhd MY_DISK.vdi --resize 819200
    

    Yes, a wrong additional zero was gone there. Of course, as an idiot I hadn't a backup.

    So I really would like to decrease this size to the desired 80 GB. Unfortunatelly, just running resize again can't do it, since the --resize only increases the size.

    I tried --compact too, but it only affects physical size. Is there anything can I do to change the logical size of my Virtual Box Disk Image?

  • Erick Petrucelli
    Erick Petrucelli over 11 years
    That steps compact the physical .vdi size. What I need is a way to reduce the max logical size which is displayed inside the guest as the hard disk size, but no the real sized showed on the host.