Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Assuming 100K per file, that means 10 files per meg, and:

  • 10K files per GB
  • 1 million files per 100 GB
  • 10 million files per TB

Is this correct?

share|improve this question
    
No, your assumptions are a rough first approximation but might be either grossly underestimated or overestimated depending on your file system type and files characteristics, which you should state in your question –  jlliagre Oct 30 '11 at 10:03
add comment

3 Answers

For the most part yes.

The only big factor that may throw off your calculations is cluster sizes. Depending on what filesystem you use, the smallest unit will be a cluster or equivalent. A file cannot use less than a cluster, so while your files may take up X amount of space and your drive is size Y, your free space isn't necessarily Y - X due to the fact that you can't put another file in a half full cluster that is occupied by another file.

share|improve this answer
    
This is not entirely true for NTFS where very small files are stored in the MFT directly. –  billc.cn Oct 30 '11 at 2:43
    
And yet there is more, on top of sparse files and the MFT growing, blah blah blah blah blah. . . –  surfasb Oct 30 '11 at 5:17
add comment

Is this correct?

Only for a first approximation.

Besides the use of disk space to store the actual file contents, you also need to account for:

  • allocation slop: the filesystem allocates space in units of N sectors (e.g. clusters). Every file size has to be rounded up to the next multiple of the allocation unit. Note: there has been at least one filesystem that allowed files to share (divvy up) an allocation unit, but this enhancement should probably not be used in your calculation.
  • filesystem overhead: disk space used to hold directory information / inodes / metadata / whatever the filesystem employs. If every file was in its own subdirectory, then more disk space would be used than if all files were in just one directory.
  • a journaled filesystem will reserve a portion of the disk space for the journal. There will be an upper limit, but the actual space used will probably be dynamic.
share|improve this answer
add comment

When measuring file sizes we are more concerned with base 2 conversions than base 10 conversions, so while your calculations are roughly correct, they are not perfect. For example, one megabyte is not 1000 kilobytes, 1 megabyte is 1024 kilobytes. When you go all the way up to terabytes, this error is compounded, so the number of files you can fit in a terabyte of space is significantly increased. If we use the parameters you gave (files exactly 100 kilobytes in size) we could actually fit 10,995,116 files into a 1 terabyte space, nearly a million more files than you suggested with your original calculation! If space is critical, it is important to remember that file sizes are calculated in base 2, not base 10.

You also want to consider what surfasb said, but since the default cluster size for most systems is 4 kilobytes you would not be wasting any space if we are using the parameters you gave (100 kilobyte sized files, 100/4 = 25 with no remainder).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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