Tuesday, November 8, 2011

No space left on device – running out of Inodes

Be cautious before performing

1. check available disk space to ensure that you still have some

$ df -hP

Filesystem 1K-blocks Used Available Use% Mounted on
/dev/cciss/c0d0p3 4.8G 342M 4.2G 8% /
/dev/cciss/c0d0p9 7.6G 329M 6.9G 5% /opt

2. check available Inodes

$ df -iP

Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/cciss/c0d0p3 1280000 1279391 0 100% /
/dev/cciss/c0d0p9 2050272 2912 2047360 1% /opt

IUse% at 100, then huge number of small files is the reason for “No space left on device” errors.

3. find those little small files as show below : from root directory

$ for i in /*; do echo $i; find $i |wc -l; done

Below command to find small files in directories .

$ for i in /home/*; do echo $i; find $i |wc -l; done

4. once you found the files like *.log, *.gz... etc

$ sudo rm -rf /home/bad_user/directory_with_lots_of_empty_files

Once delete check with df -i command again. :

Filesystem Inodes IUsed IFree IUse% Mounted on

/dev/cciss/c0d0p3 2080768 284431 1796337 14% /
/dev/cciss/c0d0p9 2050272 2912 2047360 1% /opt

If I wanted to exand inode quantity, then backup files from /storage fs and recreacte fs with additional parameter -N , which tells mkfs cmd to create desired by me inode quantity.

mkfs -t ext3 -m 1 -v -N 800000 /storage

No comments:

Post a Comment