Inode Usage Issue

What is an “inode”?

An inode is a record in a disk table, which contains information about a file or folder such as its size, owner, device node, socket, pipe, etc., except data content and file name. The number of inodes on your account equals the number of files and folders you have on it.

    # df -i   (check inode usage)

  • Find out the large files for inode usage:
    for i in /*; do echo $i; find $i |wc -l | sort ; done
    (/* = specified directory)
  • Look for biggest directories in the current working directory:

    du -a | sort -n -r | head -n 5

    du -hsx * | sort -rh | head -10 (Best)

    du -a /var | sort -n -r | head -n 10 (in /var folder)

    Let us break down the command and see what says each parameter.
    1. du command: Estimate file space usage.
    2. a : Displays all files and folders.
    3. sort command : Sort lines of text files.
    4. -n : Compare according to string numerical value.
    5. -r : Reverse the result of comparisons.
    6. head : Output the first part of files.
    7. -n : Print the first ‘n’ lines. (In our case, We displayed first 5 lines).
  • List top 10 Inodes files/folders:
    for i in `ls -1A | grep -v “\.\./” | grep -v “\./”`; do echo “`find $i | sort -u | wc -l` $i”; done | sort -rn | head -10
  • Remove all files from a folder:
    rm -rf folder/*
Scroll to top