Linux: No space left on device while df command shows a lot of free space

While working on Linux boxes system admin usually get this error “No Space left on device” While df commands show a lot of free space on the same partition or device. In my scenario I have an Apache-based application running on CentOS, I also face the same problem.

Follow the below steps to solve this problem

Step 1: Identify inodes information

To get inodes information of all the flie system, use below command:

# df -i

To get inode information for a particular file system, use below command:

# df -i /dev/mapper/my--vg-my--lv

As we can see in the above output that all the inodes of the filesystem (/dev/mapper/my—vg-my–lv) has been consumed that’s why I am getting no space left on the device while lot free space is available.

Note : We can also get inode information of a filesystem using tune2fs command, as show below:

# tune2fs -l /dev/mapper/my--vg-my--lv

STEP:2 IDENTIFY OBSOLETE OR UNNECESSARY FILES ON THE FILE SYSTEM.

Step 2: Identify obsolete or unnecessary files on the filesystem

Find all the obsolete or unnecessary files and delete them using rm command. After deleting files then we can create files and directories.

Note: There is no way to increase the number of inodes on a file system once it has been created.
Related Post