Awesome trick to shrink VirtualBox image of ROS

I had a ROS 3.30 VirtualBox image image that I’ve upgraded to 4.10, but the size of the .vdi file was like 550MB where ROS only occupied ~250MB.
Simply running ‘VBoxManage modifyvd compact’ didn’t shrink the image, however the following that I found did:

Now my .vdi file is only 237MB.
I’ve actually used Parted Magic 4.4 to downsize the partition and created an unformatted partition with it too. The dd command took a while (22MB/s) to fill the 5GB unformatted partition.
Once you’re done with the whole GParted phase, you need to run ‘VBoxManage modify <your .vdi image> compact’ to shrink the image!

Hope this can be helpful for someone :slight_smile: