How Do I Fix File Creation Failures Due to Inode Exhaustion?

Symptom

When you create a file or directory, you get the error message "No space left on device", "Cannot create directory", or "Couldn't create temporary archive name."

Possible Causes

In Linux, both of the following use the disk space:

  • Data

  • Inode

Note

An inode (index node) stores metadata of a file system object, such as a file, directory, device file, socket, and pipe in the file system, but does not contain the object's data and filename.

Constraints

The procedures described in this section involve disk initialization. Back up data in advance.

Solution

  1. Run the following command to check the available space on the disk:

    # df -h

    **Figure 1** Checking the available disk space

    Figure 1 Checking the available disk space

    As shown in Figure 1, the disk still has enough available space.

  2. Run the following command to check the available inodes on the disk:

    # df -i

    If the value of Use% in the command output is 100%, inodes are used up. Perform the following operations to free up inodes:

    1. Archive files in all directories.

      # tar czvf /tmp/backup.tar.gz /home/data

    2. Delete unnecessary files to release inodes.