Operating System - HP-UX
1753445 Members
5274 Online
108794 Solutions
New Discussion юеВ

Re: bdf and df -g output in HP-UX 11.23

 
SOLVED
Go to solution
Ajay S
Advisor

bdf and df -g output in HP-UX 11.23

Hello folks,

 

Please take a look at the bdf and df -g output on the same filesystem below. The size of the filesystem is 1000GB, but if you see the  "total blocks" output of dg -g. Insted of showing the total number of blocks, it is populating the size of the filesystem itself in KBs. my server monitoring SW uses df -g to query the filesystem sizes and it uses this field and treats it total number of blocks (as it should) and multiplies it by 8 ( 8 K blocks) and reports 8 time the actual size of the filesystem.

 

what could be the reason df -g is not reporting correctly? i know that df is depricated in HPUX. One thing to mention is that it is not happening  for all the filesystems. it reports the correct size for a number of filesystem. one of them is root FS, output in below.  

 

# bdf /new_archive6
Filesystem          kbytes    used   avail %used Mounted on
/dev/vgARCHIVE/lvarchive6
                   1048576000 968833794 74758326   93% /new_archive6

# df -g /new_archive6
/new_archive6          (/dev/vgARCHIVE/lvarchive6) :
           8192 file system block size            1024 fragment size
     1048576000 total blocks                  79742206 total free blocks
       74758326 allocated free blocks         20243232 total i-nodes
       19935551 total free i-nodes            19935551 allocated free i-nodes
     1074003974 file system id                    vxfs file system type
           0x10 flags                             255 file system name length

 

 

It reports correct for root FS

 

# bdf /
Filesystem          kbytes    used   avail %used Mounted on
/dev/vg00/lvol3    2097152  430288 1653920   21% /
root@cmdb1 - [/root]
# df -g /
/                      (/dev/vg00/lvol3       ) :
           8192 file system block size            8192 fragment size
         262144 total blocks                    208358 total free blocks
         206740 allocated free blocks            55648 total i-nodes
          52077 total free i-nodes               52077 allocated free i-nodes
     1073741827 file system id                    vxfs file system type
           0x10 flags                             255 file system name length
              / file system specific string

 

OS version 11.23

filsystem :   vxfs 4.1 onlinejfs

 

what could be the reason?

 

Thanks in advance,

 

Regards/Ajay

 

2 REPLIES 2
Matti_Kurkela
Honored Contributor

Re: bdf and df -g output in HP-UX 11.23

"man df" says the option -g is "Report the entire structure described in statvfs(2)."

And "man 2 statvfs" says:

The statvfs structure contains the following members:

fsblkcnt_t f_blocks; /* total blocks of f_frsize on file system */ 
fsblkcnt_t f_bfree; /* free blocks */ fsblkcnt_t f_bavail; /* blocks available to non-superusers or users without the LIMIT privilege */ fsfilcnt_t f_files; /* total file nodes in file system */ fsfilcnt_t f_ffree; /* free file nodes in file system */ fsfilcnt_t f_favail; /* file nodes available to non-superusers or users without the LIMIT privilege */ ulong f_bsize; /* preferred file system block size */ ulong f_frsize; /* fundamental file system block size */
[...

 "f_frsize" looks suspiciously like "fragment size" to me.

 

And the description of f_blocks, "total blocks of f_frsize on file system", means you should multiply f_blocks with f_frsize to get the size in bytes.

 

If the implementation of "df -g" just dumps out the values of the statvfs structure without doing any arithmetic on them, it looks like you should be multiplying the "total blocks" value with the "fragment size", not with the "file system block size".

 

For your root filesystem, your monitoring software works by accident, since your root filesystem has "file system block size" equal to "fragment size".

 

According to the statvfs structure comments, f_bsize (= what is reported as "file system block size" by df -g) is actually preferred file system block size, and f_frsize (= "fragment size") is the fundamental file system block size.

MK
Ajay S
Advisor
Solution

Re: bdf and df -g output in HP-UX 11.23

Thanks very much MK for explaining this to me. i didn't looked at the fragment size earlier. now i have to find a way how i can make it work so that "total blocks' do the math by multiplying it to "fragment size " and not the "file system block size".

 

I appreciate your time for looking into this.

 

 

Regards/Ajay