IBM Support

About cleartool space output versus du output

Question & Answer


Question

Why is there often a significant difference between IBM Rational ClearCase cleartool space and the sum of du -sk for all the directories beneath view or VOB storage?

Answer


The cleartool space command and the du command use different metrics to report file size. The du command uses "disk blocks" or "I/O blocks" as a metric, while the cleartool space command uses the number of bytes in use by a file as the metric.  Use of "bytes" vs "blocks" as the metric is done as the file size in bytes is a universal metric and not subject to change depending on the operating system (Solaris, Linux, Windows, etc.) and underlying filesystem in use (NTFS, ext3, etc4, ufs, etc.). As the number of disk blocks allocated to a file is almost always larger than the amount of bytes the file actually uses, the space reported by du is similarly larger. 
For example, a "stat" of this file in a view's view-private file storage area:

File: '8000000c56182c4fAmyfile.txt'
S
ize: 67              Blocks: 8          IO Block: 4096   regular file
Device: 801h/2049d      Inode: 8028019     Links: 1
Access: (0664/-rw-rw-r--)  Uid: ( 1000/   user1)   Gid: ( 1000/   group1)
Access: 2021-07-02 14:16:36.868149623 -0400
Modify: 2015-10-09 17:09:20.000000000 -0400
Change: 2017-11-20 11:34:13.851204029 -0500

the cleartool space command will read and accumulate the "Size" value, adding 67 bytes to its accumulated size for view storage. In this case, du will report the file as 4kb, and accumulate that value in its directory size calculations.
As the number of small files in the view or VOB increases, the larger the difference between the values reported by "cleartool space" and du. The view with the above file had 50,000 under-1kb view private files, which led to du reporting 319MB for the view while cleartool space reported 80MB.
On Linux hosts, you can confirm the "size-vs-blocks" issue by:
  1. CD into the .vws/.s directory for hte view where DU and cleartool space report different values.
  2. Run the following script: 

    find | while read i; do ONESIZE=`ls -ld $i | awk -e '{print $5;}'`;if [ "$SIZE" == "" ]; then SIZE=$ONESIZE; else SIZE=`expr $SIZE + $ONESIZE`; fi ; done ; echo $SIZE​​​​

The reported value should approximately equal the size reported by cleartool space -update for the directory in question when converted into megabytes (divide by 1,048,576)
The above script may need tuning to report on Solaris, AIX, or other Unix hosts.
Both cleartool space and du report "correctly" based on the metric they use to measure the "size" of a file or directory. du, because it knows about the details of the filesystem, knows the block size and how many BLOCKS are allocated (but not necessarily used) for each file. “cleartool space,” on the other hand, knows the number of BYTES in use but not the blocks allocated. cleartool space can’t assume anything about the underlying filesystem since that filesystem could be local or remote; and could have various filesystem types.
Each tool has its use:
  • If you’re trying to avoid an encroaching “out of disk space” issue: du, because it knows about the number of blocks assigned to a file, will give you the best results.
  • If you’re looking to get an immediate report on “what are my largest views,” ct space, because it collects the information “offline” will give you a report – in terms of the number of BYTES listed in the directory entries – almost immediately.
     

[{"Product":{"code":"SSSH27","label":"Rational ClearCase"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Utilities and Tools","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF015","label":"IRIX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"}],"Version":"9.0.1;9.0;8.0;7.1.2","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
07 July 2021

UID

swg21130185