Help us understand the problem. What is going on with this article?

Vagrant boxを小さくする

More than 3 years have passed since last update.

Googleで検索すると、Vagrant boxを小さくする方法が色々と公開されていたりしますが、ざっくりとまとめてみます。

sudo su -
umount /vagrant
aptitude autoclean && apt-get autoremove && apt-get clean
find /var/log -type f | while read f; do echo -ne ‘’ > $f; done && rm -rf /var/log/* /tmp/* /var/tmp/* /usr/local/src/* /var/ww/html
e4defrag / && dd if=/dev/zero of=/EMPTY bs=1M; rm -f /EMPTY
rm /root/.bash_history && /home/vagrant/.bash_history
exit

こんな感じ。
要は、ゴミを消してデフラグして、空いた領域をゼロクリア埋めする感じですね。
ちょいと、Ansibleのplaybook化してみました。

ちなみに、以前書いた「UbuntuのVirtualBox向けEFI対応」の対応内容も合わせて入れています。

https://bitbucket.org/poad1010/ansible-playbook/src/e052413a86b8a2aa9957046adf36187426463ef4/ubuntu-vagrant-box/?at=master

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした