151
146

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.

linuxでディスクがフルになったときの調査方法 du df

Last updated at Posted at 2012-09-10

いきなりdisk fullの警告が出てきて調べた時のメモ

とりあえずdf -hでディスク全体の使用状況がわかる

 df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       7.5G  5.2G  2.0G  73% /
udev            238M  4.0K  238M   1% /dev
tmpfs            99M  272K   99M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            246M     0  246M   0% /run/shm

つぎにdu -sh /*でルートディレクトリの各ディレクトリのディスクの利用状況がわかる

$ sudo du -sh /*
8.7M	/bin
68M	/boot
4.0K	/dev
7.3M	/etc
2.6G	/home

...

で、ディスクを多く使用しているディレクトリをdu -sh /var/lib/*と掘り進めていくとどこが原因かわかる

自分の場合は/var/lib/mongodb/journal/がいきなり2gbも占拠してました

追記

sortにパイプすれば一番最後にサイズが大きなディレクトリ・ファイルがきます

du -s ./* | sort -n
151
146
4

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
151
146

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?