FutureQuest, Inc. FutureQuest, Inc. FutureQuest, Inc.
Why did I get a Disk Space Violation?
Posted on 09 January 2004 05:24 AM
Question:

I received a Disk Space Violation. It says I am using 155.10 megabytes of disk space. I downloaded my entire /www directory and it was only 37.7 MB including the stats folder.

Where did the 155.1 megs come from? Checking the CNC disk space listing it shows the www files at 48.31, which isn't even close to the actual file size that I show in the www folder. What's the deal?

Answer:

There are two differing situations that may cause this:

The File Manager in your CNC only shows the space used by files inside each directory -- but *not* files further down in other subdirectories. The Disk Usage section of your CNC shows the Total Calculated Disk Space, including all of the space used by your directories *and* subdirectories.

If you go into your /www folder under File Manager, the number listed at the bottom includes all the files that are in the /www folder, but it does not include files that are in a subdirectory of /www (ex: www/otherfiles/) in that count. However, if you look in the Disk Usage section, it will show the complete total for everything in your /www and below.

There may also be a situation where you have many, many subdirectories...

What you are paying for is the actual units of storage used. In Linux, those are called blocks (in MSDOS, they are called clusters).

The minimum allocation is 4K, and that unit is what you are using and paying for. In other words, regardless if a file is 1 byte or 999 bytes, it takes the same amount of hard disk real estate to store that 1 file (i.e., a block of 4096 bytes of disk space would be allocated either way).

For example, you have 20 files each containing 10 bytes:

**File content size
20 x 10 (bytes) == 200 bytes

**Actual hard disk storage space used
20 x 4096 (bytes) == 81,920 bytes

The actual disk space allocated to store each of the 20 files is 4,096 bytes (as that is the minimum) for a total of 81,920 bytes of disk space.

If you have much MSDOS experience, you will remember this as wasted cluster SLACK space. Linux follows the same rules but on a more efficient scale. For reference, MSDOS used to build 8K clusters versus Linux's 4K clusters.

Hopefully this demystifies the reason why a 1 byte file really consumes 4096 bytes.

Note: The numbers shown in the File Manager are only for quick reference, where the Disk Usage shows what is actually being counted against your account.