Operating System - HP-UX
1834497 Members
3121 Online
110067 Solutions
New Discussion

Re: bdf and du shows different values

 
nasmel
Frequent Advisor

bdf and du shows different values

hi


My system is showing differnt values when i execute bdf and du .
I have one LUN (/soft) with 76 GB and bdf says that 94% is used ,but actual usage on that disk is very very less.

bdf and du command output is as follows
# bdf
Filesystem kbytes used avail %used Mounted on
/dev/vg00/lvol3 5242880 438040 4767352 8% /
/dev/vg00/lvol1 1392640 343568 1040936 25% /stand
/dev/vg00/lvol8 10485760 2487312 7936176 24% /var
/dev/vg00/lvol7 13631488 7736792 5848768 57% /usr
/dev/vg00/lvol6 4194304 346552 3817872 8% /tmp
/dev/vg00/lvol5 16777216 6593520 10104264 39% /opt
/dev/vg00/lvol4 2097152 23312 2058152 1% /home
DevFS 6 6 0 100% /dev/deviceFileSystem
/dev/vg01/lvol01 78639104 73946618 4399560 94% /soft
/dev/vg02/lvol01 52424704 2151119 47131490 4% /qtlusr
/dev/vg03/lvol01 104853504 16929284 82428960 17% /oradat1
/dev/vg04/lvol01 104853504 32900084 67456335 33% /oradat2
/dev/vg05/lvol01 157278208 28776491 120472115 19% /oradat3
/dev/vgarchbkp/lvarch
52428800 12118491 37791284 24% /oraarch
/dev/vgarchbkp/lvbackup
157270016 23601516 125314339 16% /backup



# du -sk /soft
4704265 /soft
# cd /soft
# ll
total 0
drwxrwxr-x 3 oracle dba 96 May 14 2009 app
drwxr-xr-x 2 root root 96 Feb 23 2009 lost+found
# du -sk app
4704265 app



/soft (/dev/vg01/lvol01) is mounted by using a cluster package.

Please advise


2 REPLIES 2
James R. Ferguson
Acclaimed Contributor

Re: bdf and du shows different values

Hi:

Large discrepancies between 'du' and 'bdf' may arise when an inuse file has been removed.

Disk space is not returned to the system until the last process using a file is closed. A common and valuable technique is to open a file; immediately unlink() [remove] it; and continue to use it for the duration of the process. When the process terminates, the used disk blocks are returned to the available pool.

To find unlinked, open files that are consuming space, use 'lsof' from the HP-UX Porting Centre:

http://hpux.connect.org.uk/

To find open and unlinked files, use:

# lsof -a +L1 /dev/vg01/lv_out

(or)

# lsof +D /dev/vg01/lv_out +L1

Look for any files with an NLINK value of zero (0). These would be files with a zero link count that will vanish when the last process terminates. The SIZE/OFFSET column will offer the character size of the file in question.

If the issue isn't an unlinked, open file it's possible that you have a 'sparse' file in the mountpoint. In this case, 'bdf' will report a value that reflects what the "inflated" sparse file would be, whereas 'du' will report only the actual, allocated blocks. Copying a sparse file (with 'cp') will "un-sparse" a file. An 'ls' for a sparse file will show the ultimate size (offset) too.

Regards!

...JRF...

Steven E. Protter
Exalted Contributor

Re: bdf and du shows different values

Shalom,

bdf and du are different utilities with different calculation methods. They are never going to fully agree.

The common cause of huge differences occurs when a systems administrator deletes a file that has an open file handle on it. Then bdf does not see the space, but du does.

fuser -cu to see open processes.

fuser -cuk USE WITH EXTREME CAUTION

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com