Df -i and Df -h innacurate results

March 6, 2016 1.2k views
Server Optimization DigitalOcean Deployment Scaling Linux Basics

Here are my df -h and df -i.

df -h

Filesystem Size Used Avail Use% Mounted on
/dev/vda1 40G 40G 0 100% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
udev 991M 4.0K 991M 1% /dev
tmpfs 201M 344K 200M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 1001M 0 1001M 0% /run/shm
none 100M 0 100M 0% /run/user

df -i

Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/vda1 2621440 172619 2448821 7% /
none 256245 2 256243 1% /sys/fs/cgroup
udev 253532 402 253130 1% /dev
tmpfs 256245 331 255914 1% /run
none 256245 1 256244 1% /run/lock
none 256245 1 256244 1% /run/shm
none 256245 2 256243 1% /run/user

From the df -i I still have 2448821 to use however, my droplet is displaying no space available. is there anyawy I can use the space?

1 Answer

The df -i command shows inode statistics while df -h shows the size statistics.

the inode is a data structure used to represent a filesystem object, which can be one of various things including a file or a directory.

https://en.wikipedia.org/wiki/Inode

Think of it as an elevator which can accommodate 9 people and has a weight limit of 1000KG. Four people get in with very heavy luggage all of them totaling close to 1000KG. Now even if there is room for more people the elevator cannot work.

So if one single file took up lots of space (like 30G) you'd still have free inodes while the disk is full.

Use the following command to find out which directory is taking up a lot of space.

sudo du -h --max-depth=1 /

This command could take a long time. After it completes drill down to the largest directory .

Example:

sudo du -h --max-depth=1 /var

Keep executing the du command till you find the directory that houses the large files.

Have another answer? Share your knowledge.