Article From:

It is very convenient to use vagrant, but after a year’s use, you want to pack and archive vagrant so that it can be reused later.
But vagrant packaged box files are getting bigger and bigger, from 300M at first to more than one G later, to more than two G now. Is there any way to optimize file size?

For example, delete log files and empty apt cache or something?
Are there any other suggestions for comparison?

Answer 0:

Environmental Science:
The physical machine win7, software VirtualBox, vagrant1.9, VirtualBox system is CentOS.

Operation method:

1,The system in the virtual machine first installs zerofree
2,Entering the virtual machine system execution

1:umount /dev/sda1
2:zerofree -v /dev/sda1

3,vagrant halt
4,Converting vmdk to VDI format

VBoxManage clonehd "pathto/box-disk001.vmdk" "pathto/box-disk001.vdi" --format vdi

5,virtualbox Find the Virtual Machine Menu: Settings – “Store the original vmdk image deleted, add the new converted image and then determine
6,vagrant upTry to start
7,vagrant package Export. The mirror image is obviously reduced.

Reference resources:……

Leave a Reply

Your email address will not be published. Required fields are marked *