2
2

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.

Unixのサーバでのディスク容量に対処する

Last updated at Posted at 2016-02-05

背景

急に使ってるサーバでディスク容量が不足したというような警告が流れてくる場合があります。

その場合にどう対処したかを書いておきます。

現状把握

まずはどこが沢山使っているかを調べ、その後に多く使っている所の不要なファイルを消していきます。

  1. 各パーミッション・ファイルシステムの使用状況確認
[root@hoge]df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda3        97G  2.8G   89G   3% /
tmpfs           499M     0  499M   0% /dev/shm
/dev/vda1       243M   53M  178M  23% /boot

  1. duコマンドで各ディレクトリ毎の使用量調査
[root@hoge]du -csh  /*
7.6M	/bin
47M	/boot
172K	/dev
28M	/etc
271M	/home
250M	/lib
22M	/lib64
4.0K	/lost+found
4.0K	/media
4.0K	/mnt
8.0K	/opt
0	/proc
5.2M	/root
15M	/sbin
4.0K	/selinux
4.0K	/srv
0	/sys
80K	/tmp
1.3G	/usr
407M	/var
160M	/web
2.5G	合計
  1. さらに絞り込む

ここで使いすぎなディレクトリ(だいたいは、/varとか/tmpとか)が分かれば、その中でどのファイルが大半を占めているのかさらに絞り込んでく

今回はそんなに大きな容量のものはなかったですが、あったとしたらこんな感じっての貼っときます。

[root@hoge] find /home -size +10M -exec ls -lh {} \;
....中略...

で、容量使い過ぎなファイルを消して一見落着。となるハズ

2
2
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
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?