dwyl / dwyl/learn-devops

How to check Disk Usage on Linux ("no space left on device") ?

Open
#42 1 comment 0 reactions 0 assignees View on GitHub
question
Dominant language
Shell
Stars
443
Forks
177
PR merge metrics
No merged PRs in 30d

Description

reading: https://unix.stackexchange.com/questions/125429/tracking-down-where-disk-space-has-gone-on-linux
most popular answer recommends `ncdu` ("NCurses Disk Usage"): https://dev.yorhel.nl/ncdu
which uses: https://en.wikipedia.org/wiki/Ncurses

So I need to install both `ncurses` and `ncdu` for Centos ...

Install EPEL (Extra Packages for Enterprise Linux)
https://fedoraproject.org/wiki/EPEL
```sh
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
```
Unfortunately, I get the **`No space left on device`** error when attempting to install (_duh!_)
![image](https://user-images.githubusercontent.com/194400/42503092-abdd0768-842f-11e8-93a5-d2baf4233f06.png)

So I need to use (_good old_) `du` _first_!
```sh
du -Pshx /* 2>/dev/null
```
![image](https://user-images.githubusercontent.com/194400/42503541-d811a0e0-8430-11e8-9e0a-bcc78335d369.png)

In the `/home` directory, run: `du -sm * | sort -n`
![image](https://user-images.githubusercontent.com/194400/42503639-17799c2e-8431-11e8-953d-8ac585bf6611.png)

![image](https://user-images.githubusercontent.com/194400/42503784-7fa997ae-8431-11e8-80fd-e25374a898f0.png)

# You have new mail in /var/spool/mail/root

to read the "mail" run:
```sh
cat /var/spool/mail/root
```
via: https://superuser.com/questions/306163/what-is-the-you-have-new-mail-message-in-linux-unix

After deleting a few of the "stale" apps:
![image](https://user-images.githubusercontent.com/194400/42505179-e6a0fbe2-8435-11e8-9fba-3ac3f4bef707.png)

I can _re-attempt_ to install `ncdu`:
```sh
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
```
followed by:
```sh
yum install ncdu -y
```
![image](https://user-images.githubusercontent.com/194400/42505252-21b3499c-8436-11e8-94ba-1df4d61983bd.png)

Run `ncdu` and then navigate!
![image](https://user-images.githubusercontent.com/194400/42505302-4af817c4-8436-11e8-8f7c-b66dd4c278b9.png)

Turns out the disk hog is the `node_modules` cache ... 🙄

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.