8
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Vagrant boxを小さくする

Posted at

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対応」の対応内容も合わせて入れています。

8
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?