Simple tip: Inodes

January 15, 2009

Sometimes when on a Linux system, you will encounter a problem with running out of disk space when it appears that you haven’t. This is because there are actually two different resources on a Linux filesystem.

  • Disk space – this is the total amount of space allotted to all of your files.
  • Inodes – this is the amount of files you can create on the filesystem.

You might be running out of inodes. This will usually happen if you have a lot of small files. You can find out by running

df -i

And you will get output similar to this:

---> root@machine (0.04)# df -i
Filesystem            Inodes   IUsed   IFree IUse% Mounted on
/dev/mapper/VolGroup00-LogVol00
                     2080768   46917 2033851    3% /
/dev/xvda1             26104      35   26069    1% /boot
none                  262144       1  262143    1% /dev/shm

On some linux filesystems, you can change this value on a running filesystem. It’s not recommended to try doing so on ext2/ext3, and the option doesn’t even exist on some later versions of tune2fs. The best way to increase this value is to copy your data off, rebuild the filesystem with a larger inode value (using the -N) option, and copying it back on. Or you could find another drive or storage medium and mount it underneath your root directory, thereby giving you another disk full of inodes to use. The path you’ll want to take is dependent on your own circumstances and goals.

  • Share/Bookmark

Leave a Reply