3

I have created virtual box hard disk for Ubuntu 16.04 system. I have dynamically allocated hard disk space of 8GB. After installation, the actual size is only around 3GB. My requirement is, now, I want to reduce 8GB space to 4GB because that is enough space. I need this because, I can create a 4GB image from VDI file and then can write this image to 4GB USB sticks. I am using Virtual Box 5.0.24_Ubuntu r108355 and Ubuntu 16.04.1

Note: I have used VBoxManage command to modify hard disk:

# sudo VBoxManage modifyhd Ubuntu-16-04-1.vdi --resize 4096
/usr/lib/virtualbox/VBoxManage: /usr/local/lib/libldap_r-2.4.so.2: no version information available (required by /usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4)
/usr/lib/virtualbox/VBoxManage: /usr/local/lib/liblber-2.4.so.2: no version information available (required by /usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4)
0%...
Progress state: VBOX_E_NOT_SUPPORTED
VBoxManage: error: Resize medium operation for this format is not implemented yet!

Basically I faced this problem :

VBOX_E_NOT_SUPPORTED

VBoxManage: error: Resize medium operation for this format is not implemented yet!

EDIT: I wanted to reduce the Virtual Disk Size, not the VDI file itself. I want to make ISO image from VDI file, and shrinking basically did not help me, it was always 8GB.

krishna
  • 145

1 Answers1

5

From the Virtual Box Manual:

The --resize x option ... currently works only for VDI and VHD formats, and only for the dynamically allocated variants, and can only be used to expand (not shrink) the capacity.

So it is not implemented to decrease the size of an existing virtual disk.

To physically shrink a dynamically allocated VDI see

In order to have a smaller logical virtual drive you need to copy the content to a newly created smaller drive.

Takkat
  • 142,284