79

I am getting the error "No space left on device" when i tried to scp some files to a centos machine,

tried to check:

[root@...]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol01 18G   18G     0 100% /

And when I do

du -sh / -> it gives only 5G

[... ~]$ df -i /
Filesystem            Inodes   IUsed   IFree IUse% Mounted on
/dev/mapper/VolGroup00-LogVol01
                     4685824  209516 4476308    5% /

seems like file system is full. How can i find which one is taking these much size?

Futuregeek
  • 1,900
  • 3
  • 26
  • 51
  • Maybe you get more/better answers on 'Superuser' or 'Unix & Linux'. Please show your scp command and the complete df list. Are you sure that you copy to /dev/mapper/VolGroup00-LogVol01? – smartmeta Jul 10 '14 at 08:28
  • i tried to start some services in that server. it is also giving the same error – Futuregeek Jul 10 '14 at 08:32
  • Silly me, my target that was full was a symlink to another drive that was full! – Sridhar Sarnobat Mar 22 '22 at 22:51

4 Answers4

78

Such difference between the output of du -sh and df -h may happen if some large file has been deleted, but is still opened by some process. Check with the command lsof | grep deleted to see which processes have opened descriptors to deleted files. You can restart the process and the space will be freed.

VolenD
  • 3,592
  • 18
  • 23
65

Maybe you are out of inodes. Try df -i

                     2591792  136322 2455470    6% /home
/dev/sdb1            1887488 1887488       0  100% /data

Disk used 6% but inode table full.

tripleee
  • 175,061
  • 34
  • 275
  • 318
BenJLI
  • 650
  • 5
  • 4
  • 1
    can we add some more inodes ? :)) (partly joking, partly serious) – Ciprian Tomoiagă Feb 16 '18 at 08:17
  • https://unix.stackexchange.com/questions/26598/how-can-i-increase-the-number-of-inodes-in-an-ext4-filesystem tl;dr no, not really - you can only add more inodes by creating a new filesystem with more inodes and then copying the existing filesystem onto the new filesystem. – Chris Browne Jan 04 '21 at 12:24
  • 1
    You used 6% of the /home but the /dev/sbd1 used 100% - that is the problem. Most likely you have way too many log files. Find large files by running: `find / \( -path /proc -prune -a -path /dev -prune \) -o -type f -size +100M -exec ls -s1 {} \; 2>/dev/null| sort -n -r | head -n 20` – Robert Guice May 10 '21 at 17:39
15

To list processes holding deleted files a linux system which has no lsof, here's my trick:

    pushd /proc ; for i in [1-9]* ; do ls -l $i/fd | grep "(deleted)" && (echo -n "used by: " ; ps -p $i | grep -v PID ; echo ) ; done ; popd
Bence Frenyó
  • 301
  • 3
  • 5
1

You can execute the following commands

lsof / |grep deleted

kill the process id's, which free up the disk space.