brent timothy saner on 28 Sep 2017 09:54:50 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Reclaiming inodes


On 09/28/2017 12:45 PM, Michael Lazin wrote:
> I work at a hosting company and we set file limits for this reason.  I
> have run into occasions where I have wanted to find the directory with
> the most files and have used something like this which I shamelessly
> took from stack exchange:
> 
> |find / -xdev -type d -size +100k
> (SNIP)

not quite:

_____________________________________________________________________
       -size n[cwbkMG]
              File uses n units of space, rounding up.  The following
suffixes can be used:

              `b'    for 512-byte blocks (this is the default if no
suffix is used)

              `c'    for bytes

              `w'    for two-byte words

              `k'    for Kilobytes (units of 1024 bytes)

              `M'    for Megabytes (units of 1048576 bytes)

              `G'    for Gigabytes (units of 1073741824 bytes)

              The size does not count indirect blocks, but it does count
blocks in sparse files that are not actually allocated.  Bear in mind
that the `%k' and `%b' format specifiers of -printf handle sparse files
differently.  The
              `b'  suffix  always denotes 512-byte blocks and never 1
Kilobyte blocks, which is different to the behaviour of -ls.  The + and
- prefixes signify greater than and less than, as usual, but bear in
mind that the size is
              rounded up to the next unit (so a 1-byte file is not
matched by -size -1M).
_____________________________________________________________________


a better option would be:

    find / -xdev -printf '%h\n'|sort|uniq -c|sort -n -k1

but note that this is going to take a long time.

Attachment: signature.asc
Description: OpenPGP digital signature

___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug