After experimenting with lots of Vagrant boxes, I wanted to free up some disk space. I destroyed all Vagrant instances listed in vagrant global-status, and removed all boxes listed in vagrant box list. However, there was still over 100 GiB of junk files leftover in ~/.vagrant.d/tmp.
Could Vagrant please add a clean command to remove these files, and do a better job generally of deleting unnecessary files?
Hey,
also does it hold anything required for VMs runtime at any given moment ? So I can just keep deleting stuff after rebuilding my team devops landscape.
Hi,
Any progress on those aspects?
We are automatically building Vagrant boxes on our CI machine at each commit in the machines definitions repo, and ~/.vagrant/tmp/ becomes huge, and seems to contain mainly leftovers from previous revisions builds.
+1 for this
Hey all -
I have made a pull request at https://github.com/hashicorp/vagrant/pull/10479 which cleans up the temp directory after the package command completes. This should remove any _new_ extra box files from the tmp directory when running the vagrant package command.
Thanks!
Brian, thank you for your work on this. Quick question, so this will basically be out with the 2.2.3 version of Vagrant? or are there any nightly builds we can download to take advantage of this feature now.... if not, is it ok if I manually delete these tmp files with no issue?
Thank you
E.
@elliotholden - This patch will be available once Vagrant 2.2.3 is released, which should be soon. You should be able to delete these files without issue as long as the package command is complete. :)
@briancain Thank you for putting in the work for this, very cool!
Just to make sure, how thread-safe is this? If I'm packing up different boxes in different iTerm tabs, will the cleanup remove only the files associated with that session's build?
Yes, it only cleans up the tmp directory that it creates, not a different tmp directory.
I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Most helpful comment
Hey all -
I have made a pull request at https://github.com/hashicorp/vagrant/pull/10479 which cleans up the temp directory after the package command completes. This should remove any _new_ extra box files from the tmp directory when running the
vagrant packagecommand.Thanks!