Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Is there any unix file system (or network fs) that can get size of folder without iterating over its content?

I need the fastest and cheapest way to get size of folder (maybe some fs cache metadata on nodes?), iterating over its content is too slow.

share|improve this question
    
Some more details would improve this question. For instance, how are you currently determining size? Are you reading in the files and counting the bytes or just reading the metadata? Also, how slow is "slow"? Actual numbers here are important. You may have reached the limits of your physical disks and only changing those will help (RAID, 15krpm, SSDs, all of the above, etc.). Your measuring methodology will be important too. It's very easy to get misleading performance data about disks thanks to the filesystem cache. –  Ladadadada Jan 27 '13 at 12:34
add comment

closed as not constructive by EEAA, Khaled, Ward, mdpc, Dave M Jan 27 '13 at 20:04

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer

up vote 1 down vote accepted

[Linux only answer] If there is a specific set of folders you want to measure fast you could try to use:

  • separate filesystems/mountpoints (e.g. on LVM to ease management), then use df to get size. Be aware that df on some filesystems are not 100% accurate.
  • XFS project quotas and then see disk usage by xfs_quota -x -c "report -p". You can assign huge disk space or disable quota enforcements by using uqnoenforce mount option.

Personally I would go to XFS project quotas on kernels that do support it.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.