Technical article 105391

I am not seeing the data on my DTFS filesystem being compressed.

OpenServer 5.0.0OpenServer 5.0.2

Written · Last revised

Problem

I am using the DTFS filesystem, which is supposed to save space
by compressing the data as it is written to the disk.  However,
when I use "df -v" to report the size of the filesystem, it says
that I still have the same amount of space as when I created it
under the divvy(ADM) command.  Not only that, if I copy a file from
a non-DTFS filesystem to my DTFS filesystem and then list it with
"ls -l", the size of the file is the same; there is no compression.
I have made sure that the DTFS filesystem is not mounted with the
"nocomp" (no compress) option.

Cause

Your filesystem is doing compression.  To understand how the
compressed files are shown requires an understanding of how they
are compressed.
When a file is copied from a non-DTFS filesystem to a DTFS
filesystem, the file is compressed internally; that is, it uses
a smaller number of disk blocks.  However, it is still displayed
as the uncompressed size when listed.
There are three primary ways of displaying file size information:
df(C), du(C), and ls(C).

Using "df -v" will display the total number of 512 byte disk blocks in a filesystem, the number used, the number free, and the percentage of blocks used:

Mount Dir  Filesystem              blocks      used      free   %used
/          /dev/root              1000000    850610    149390    85%
/stand     /dev/boot                30720     20694     10026    68%
/fsdtfs    /dev/fsdtfs             200000         0    200000     1%

In this example, the DTFS filesystem is called "fsdtfs" and is 200000 blocks (100 megabytes) in size. At the moment, there are no blocks used on the filesystem (although in a real case even a recently created filesystem would still have some directory information).

Consider a large file in the root directory, about 2 megabytes in size. We can list it with "ls -l":

-rw-------   1 jayc     support  2113586 Dec 19 09:32 bigfile
This file should take up about 4000 512 byte disk blocks on a
standard non-DTFS filesystem.  We then move it to the DTFS
filesystem:
mv /bigfile /fsdtfs/bigfile

If we list the file with "ls -l" it will show us the same size:

-rw-------   1 jayc     support  2113586 Dec 19 09:32 bigfile

However, if we look at the block usage with "df -v":

Mount Dir  Filesystem              blocks      used      free   %used
/          /dev/root              1000000    846610    153390    85%
/stand     /dev/boot                30720     20694     10026    68%
/fsdtfs    /dev/fsdtfs             200000      3244    196756     3%

we see that while the root filesystem lost 4000 blocks the fsdtfs filesystem only gained 3244 blocks - "bigfile" was compressed internally from 4000 blocks to 3244 blocks. This indicates that compression is working.

A way of checking how many blocks are being used for a specific file is with the du(C) command. The du(C) command will report the specific number of internal disk blocks being used for a file. Running "du bigfile" when "bigfile" is in the fsdtfs filesystem gives us the following:

3244   bigfile

If we moved "bigfile" back over to the root filesystem and ran "du bigfile" again, we would see the full uncompressed size:

4000   bigfile

You should compare the file size (ls(C)) to the internal block usage (du(C)) to determine if files are being compressed. If the size reported with ls(C) is about 512 times the value of the usage reported with du(C), then the file is not internally compressed. If the size reported with ls(C) is significantly more than 512 times the value reported with du(C), then the file is internally compressed.

You can also get the number of blocks used directly with the "-s"
option in ls(C).  Using the command "ls -ls bigfile" would show:
3244 -rw-------   1 jayc     support  2113586 Dec 19 09:32 bigfile

You can then do a direct comparison of the the block usage with the reported file size to see if compression is being used.

One of the primary reasons that "ls -l" displays the uncompressed size of a file instead of the compressed size is that it is dangerous not to know the true uncompressed size of a file. If, for example, a file on a DTFS filesystem was listed as 1.1 megabytes compressed, we would not know whether we could copy that file over to a 1.4 megabyte floppy without running out of space.

See also

du(C), divvy(ADM), ls(C), df(C), mount(ADM)

From the Xinuos technical article database, record 105391. Reproduced with permission. The original is at www.sco.com/ta/105391, which is reachable but blocked from search engines. Xinuos marks this article against a retired product line. That refers to the product’s lifecycle, not to whether the advice still works — plenty of it still applies to running systems.

Next step

Need this fixed rather than explained?

Tell us the release, what the system runs and what it is doing. We will reply by email with what we would do next.

  • You deal with the people who do the work
  • No obligation, and no upgrade required before we will help
  • We tell you plainly if something is not worth doing

Send an enquiry

We reply by email. If a server is down, say so in the first line. You can also write to help@scoexpert.com.