0
0

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 1 year has passed since last update.

ディスク容量逼迫の被疑があるディレクトリを探す

Last updated at Posted at 2023-08-17

はじめに

すんごい久しぶりにディスク容量の調査を行ったので備忘録。AL2です。

まず最初に

df -h
まずこれを/とかで実行する。
Permission Deniedが出るのでrootにスイッチするかsu -で。

du -h -d 1 /
怪しいところを深掘りする。
ちなみに-d 1の意味は以下の通り。ありがとうBing大先生…!

このオプションは’depth’(深さ)を意味します。
'du’に対してディレクトリ構造を1レベルだけ深く探索するよう指示します。
この場合、ルートディレクトリ(/)内のディレクトリのサイズだけを計算します。

du -h -d 1 /var/log
後はモリモリ深掘りする。/var/logは例です

次に

du -hs *
これを実行すると、各ファイル&ディレクトリの容量をバーっと出力してくれる。

以下は怪しいディレクトリで実行した例。
わかんなかったら/で実行→でかすぎるサイズになってるフォルダにcd→また実行、を繰り返すと幸せになれる。

[sosat117 怪しいディレクトリ]# du -hs *
8.0K	hogehoge.yml
48.0K	hugahuga.txt
10G	    piyo(dir)

以上です!

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?