Find the answer to your Linux question:
Results 1 to 4 of 4
I've got kind of an odd situation. I'm running into inode limit issues with our VPS, and I can't seem to figure out what's creating all these files. I've had ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Mar 2009
    Posts
    2

    Locate folders with the most files


    I've got kind of an odd situation. I'm running into inode limit issues with our VPS, and I can't seem to figure out what's creating all these files. I've had our host increase the inode limit twice, but still running into the same issues.

    I've found some extra files in the qmail queue, but they're really only a drop in the bucket. Something is creating a large number of what must be very small files, and I'm not sure what it might be.

    What I'm hoping to find is some sort of command that will show me how many files are in each folder on the server. Googling really hasn't helped in this case, so I'm hoping someone here can help.

  2. #2
    Linux Newbie
    Join Date
    Mar 2009
    Posts
    228
    Create this script, call it ct.sh

    Code:
    #!/bin/bash
    
    find /mountpoint/* -xdev -type d | while read _dir
        do
            _ct=`find $_dir -type f | wc -l`
            echo $_ct $_dir
        done
    Make is executable with: chmod 700 ct.sh

    Then run it with:

    Code:
    ./ct.sh | sort -k1,1nr | head 20
    This will list the top 20 directories with many files.

  3. #3
    Linux Newbie
    Join Date
    Feb 2009
    Location
    Third ring of Pergatory
    Posts
    199
    I might use
    Code:
     
    inotifywatch -r  -e modify -t300 directory1
    It will tell you which files got modified (or created) recursively from the directory named in directory 1 for however many seconds you set in "-t".
    There is a lock out on the number of files a single instance can watch (8192 on my system as set by /proc/sys/fs/inotify/max_usr_watches) if you call it recursively and your target is larger than that, it bombs,

  4. #4
    Just Joined!
    Join Date
    Mar 2009
    Posts
    2
    Quote Originally Posted by lomcevak View Post
    Create this script, call it ct.sh

    Code:
    #!/bin/bash
    
    find /mountpoint/* -xdev -type d | while read _dir
        do
            _ct=`find $_dir -type f | wc -l`
            echo $_ct $_dir
        done
    Make is executable with: chmod 700 ct.sh

    Then run it with:

    Code:
    ./ct.sh | sort -k1,1nr | head 20
    This will list the top 20 directories with many files.
    Thanks. I was able to find the problem files. Now I just need to figure out what's creating them.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •