[CentOS] Cannot open: No space left on device

Fri Sep 11 19:15:20 UTC 2015
Warren Young <wyml at etr-usa.com>

On Sep 11, 2015, at 12:57 PM, reynierpm at gmail.com wrote:
> 
> html/elclarinweb.dev/wp-content/uploads/2015/03/12-Aura-Ávila-400x320.jpg:
> Cannot open: No space left on device
> 
> *df -h*
> Filesystem                         Size  Used Avail Use% Mounted on
> /dev/mapper/vg_server-lv_root      26G   24G  869M  97% /

Linux boxes typically reserve the last 5% of volume space for use by root only, so as far as your normal user is concerned, the volume is in fact full.

> *du -hsx * | sort -rh | head -10*
> du: cannot access `proc/3662/task/3662/fd/4': No such file or directory
> du: cannot access `proc/3662/task/3662/fdinfo/4': No such file or directory
> du: cannot access `proc/3662/fd/4': No such file or directory
> du: cannot access `proc/3662/fdinfo/4': No such file or directory

You need to be careful with commands that descend into /proc like that, because its contents changes rapidly.  Here, you’ve seen that PID 3662 disappeared between the time your * glob was evaluated and the du command actually tried to run on it.

Your du -x argument says restrict to a single filesystem, but that is evaluated per FILE argument, so it doesn’t prevent du from walking off the LVM and into /proc.  To do that, you’d need to say “du -hsx /”, but then you don’t get the results you want.

Instead, I’d recommend just explicitly listing the most likely pigs: /usr, /var, /home, and /etc.

> 14G     var
> 1.8G    usr
> 278M    lib
> 77M     boot
> 31M     etc
> 27M     lib64
> 15M     sbin
> 7.8M    bin
> 188K    dev
> 112K    root

I see about 16 GiB.

> Why *df -h* is reporting 24G used? Where the space did go? How I can fix
> this?

24 - 16 = 8, which sounds suspiciously like the size of a swap file.  What does mount say?