9
8

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.

No space left on deviceで、Volume増やしたけど、growpartコマンドすら実行できない状況を解決(docker containerを削除した)

Last updated at Posted at 2018-08-06

問題

とりあえずおなじみの no space left on deviceのエラー

df -h
Filesystem      Size  Used Avail Use% Mounted on
...
/dev/xvda1      7.7G  7.7G     0 100% /
...

普通にググると、Volume増やして、sudo growpart /dev/xvda 1とかすればいけるとかいてあるが、問題は、満パン過ぎて、/tmp以下にファイルをかけず、growpartコマンドすら聞かず、spaceを増やせない。

growpart /dev/xvda 1
mkdir: cannot create directory '/tmp/growpart.1959': No space left on device
FAILED: failed to make temp dir

AWSのInstance自体を再起動してもだめ。

解決方法: やっぱりファイルを消すしか無い

 sudo du -x -h / | sort -r -h | head -40

これで一番でかいやつから見ていくと、/var/lib/docker/containerの中身がでかすぎるので削除することに決定。dockerサービスすら立ち上がらないので。

とりあえずでかいcontainersを削除

 sudo rm -rf /var/lib/docker/containers/<hash値>

この時点でほぼ解決

df -h
Filesystem      Size  Used Avail Use% Mounted on
...
/dev/xvda1      7.7G  3.2G  4.5G  42% /
...

これで拡張できるようになったので、以下を実行

sudo growpart /dev/xvda 1
sudo resize2fs /dev/xvda1

これで解決!

df -h
Filesystem      Size  Used Avail Use% Mounted on
...
/dev/xvda1      9.7G  3.2G  6.5G  34% /
...
9
8
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
9
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?