2

We are using Centos & cPanel server but we have a important problem for INODES usage.

"df -i" command showing for / directory using 6 million inodes!.

When I check number of files for / directory, it has few thousand files.

df -i

Filesystem            Inodes   IUsed   IFree IUse% Mounted on
/dev/sda4            6578176 6567525   10651  100% /
tmpfs                8238094       1 8238093    1% /dev/shm
/dev/sdi1            61054976     169 61054807    1% /backup
/dev/sda1              51296      38   51258    1% /boot
/dev/sda2                  0       0       0    -  /boot/efi
/dev/sdc1            7290880    1252 7289628    1% /database
/dev/sdb2            4096000   53258 4042742    2% /home
/dev/sdd1            7290880    3500 7287380    1% /home2
/dev/sde1            7290880   68909 7221971    1% /home3
/dev/sdg1            7290880   68812 7222068    1% /home5
/dev/sdh1            7290880  695076 6595804   10% /home6
/dev/sdf1            7290880   58658 7232222    1% /tmp

df -h

Filesystem            Size  Used Avail Use% Mounted on
/dev/sda4              99G   30G   65G  32% /
tmpfs                  32G     0   32G   0% /dev/shm
/dev/sdi1             917G  270G  601G  32% /backup
/dev/sda1             788M   80M  669M  11% /boot
/dev/sda2             400M  296K  400M   1% /boot/efi
/dev/sdc1             110G  1.5G  103G   2% /database
/dev/sdb2              62G  1.1G   58G   2% /home
/dev/sdd1             110G   79G   26G  76% /home2
/dev/sde1             110G  3.9G  101G   4% /home3
/dev/sdg1             110G   51G   54G  49% /home5
/dev/sdh1             110G   64G   41G  62% /home6
/dev/sdf1             110G  611M  104G   1% /tmp

INODES USAGE

160  - backup
102  - bin
36   - boot
1243 - database
1197  - dev
1733  - etc
53862 - home
3529  - home2
68986 - home3
1    - home4
68814 - home5
695229 - home6
10738  - lib
359  - lib64
1    - lost+found
1    - media
1    - mnt
806  - opt
262898  - proc
1780  - root
170  - sbin
1563  - selinux
1    - srv
20034  - sys
56921 - tmp
89539 - usr
8274  - var

SDA disk just have Operating System and cPanel. There is no account, database, tmp on SDA disk.

Why SDA using high inodes?

Note: All disks is SSD 120GB

Thanks.

4 Answers 4

3

You have either:
a) 6 million files/directories/links under /; or
b) A corrupted file system.

My money is on (b), so I suggest you take your system down and run fsck (fsck -y will minimize the pain) and see if it cleans up the mess.
If your filesystem is not corrupted then delete some files.

2
  • I checked file system with fsck but, there is no much errors, just few inodes count wrong (250 - 500). I checked / directory for which using million files but no luck. Added number of inodes usage for / directory in my question.
    – MSTF
    Oct 19, 2012 at 1:55
  • 1
    @MSTF Is it possible you have a filesystem mounted on top of a directory with lots of junk in it? (/tmp would be my guess since you say that's where PHP is storing sessions: If your normal /tmp failed to mount that would clutter your root partition, and be masked the next time the normal /tmp was mounted).
    – voretaq7
    Oct 19, 2012 at 15:49
1

Probably, there are a lot of php sessions in /var/tmp, check the settings of php.ini and disable session auto start feature. Also, the issue is solved here: https://stackoverflow.com/questions/653096/howto-free-inode-usage

1
  • /var/tmp is empty, PHP sessions is storing in /tmp and this directory in another HDD.
    – MSTF
    Oct 19, 2012 at 1:57
1

Sometimes it is too complicated to clear this directory because of the memory limit on your server. The shell command 'find' uses a lot of memory and very often the server kills this command automatically. In my case, I had almost 2M files inside this directory and 'find' was not working for me. If you have the same problem, the best way is to delete files one-by-one and the best way is to use this command IMHO (you can remove 'head' if you want -)))

  • go to the /var/lib/php/sessions
  • ls -U | head -100000 | xargs rm

Enjoy!

0

On my CentOS server, PHP sessions are stored in /var/lib/php/sessions. Deleting session files with

rm -f /var/lib/php/sessions/*

wouldn't work because there were too many files in the directory. Use

find session/ -type f|xargs rm
1
  • 1
    You can do even better: find /var/lib/php/session -type f -delete May 28, 2013 at 16:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .