cancel
Showing results for 
Search instead for 
Did you mean: 

bdfmegs ver 6.1 available

Bill Hassell
Honored Contributor

bdfmegs ver 6.1 available

bdf is not very useable for GB and TB filesystems, and splits lines for long source device names.

 

bdfmegs is a script to provide one liners for every mountpoint, and summarize and provide detailed information about filesystems, as well as select filesystems based on VG/DG name, mountpoint name and percentage full.

 

Several new features have been added in the last year or so:

 

  • Snapshot volumes are shown
  • Added LVM VG version to -v option (11.31 feature)
  • Added NFS version to -v option
  • Added MemFS support
  • Added VxVM paths to -N and -V options

Usage information:

# bdfmegs -?

Usage:  bdfmegs [ -cghlNPpqstuVv ] [ <file(s) or dir(s)> ]
  where:
    -c # = Sort on column #
    -d = Toggle divisor (1000 or 1024, current=1000)
    -e = enhancement for percentage and errors
         d=dim h=halfbright i=inverse u=underline b=blink
    -g = show gigabytes, otherwise megabytes
    -h = Usage
    -l = local (no NFS)
    -M   <mountpoints> = skip (grep -v) mountpoints
    -N   <VGnames> = skip one or more volume groups
         Repeat -N or use commas: -N vg10,vg24
    -p   ## = highlight % -ge ##
    -P   ## = show only % -ge ##
    -q = suppress header line and no char enhancements
    -s = summarize total, used and available
    -t   <fs> = filesystem: (hfs vxfs nfs cdfs cifs autofs DevFS memfs)
    -u = usage
    -v = verbose (FStype, FSversion, largefiles)
         (VG version needs read permission for devicefile)
    -V   <VGname> = select one or more volume groups
         Repeat -V or use commas: -V vg00,vg01

File(s) or dirpath(s) may be specified to reduce the output of bdfmegs:

       bdfmegs -vg /usr/contrib/bin . .. /var/tmp

If bdfmegs is run as bdfgigs (ie, a link), then -g is default.
                                         (bdfmegs ver 6.1_Nov2011)

 

Examples

Standard output

# bdfmegs
File-System        Mbytes    Used   Avail %Used Mounted on
/dev/vg00/lvol3       557     327     227   59% /
/dev/vg00/lvol1       298      56     212   21% /stand
/dev/vg00/lvol8      10.2g   7018    3200   69% /var
/dev/vgbig/lvol5    102.4g   9525    87.1g  10% /var/tmp/crashdumps
/dev/vgbig/lvol3     61.4g     91    57.5g   0% /var/tmp/atldepots
/dev/vgbig/lvol6     4096    2399    1590   60% /var/tmp/Training
/dev/vgbig/lvol2    512.0g  213.5g  279.8g  43% /var/tmp/Packages
/dev/vgbig/lvol7     51.2g   7548    40.9g  16% /var/tmp/Docs
/dev/vgbig/lvol4     51.2g   11.9g   36.8g  24% /var/tmp/CustomerData
/dev/vgbig/lvol1    204.8g   69.5g  126.8g  35% /var/opt/ignite
/dev/vg00/lvol7      3702    1895    1793   51% /usr
/dev/vg00/lvol4       204     168      36   82% /tmp
/dev/vg00/lvol6      6291    5621     664   89% /opt
/dev/vg00/lvol5       102      28      72   28% /home
/dev/vg03/lvol1      15.4g     40    14.4g   0% /FileLibrary
/dev/vgatl8/lvol1  1002.5g  709.8g  290.5g  71% /support

Verbose output

# bdfmegs -v
File-System        Mbytes    Used   Avail %Used   Type Vr Lrg Mounted on
/dev/vg00/lvol3       557     327     227   59%   vxfs  5 yes /
/dev/vg00/lvol1       298      56     212   21%    hfs na  -- /stand
/dev/vg00/lvol8      10.2g   7018    3200   69%   vxfs  5 yes /var
/dev/vgbig/lvol5    102.4g   9525    87.1g  10%   vxfs  5 yes /var/tmp/crashdumps
/dev/vgbig/lvol3     61.4g     91    57.5g   0%   vxfs  5 yes /var/tmp/atldepots
/dev/vgbig/lvol6     4096    2399    1590   60%   vxfs  5 yes /var/tmp/Training
/dev/vgbig/lvol2    512.0g  213.5g  279.8g  43%   vxfs  5 yes /var/tmp/Packages
/dev/vgbig/lvol7     51.2g   7548    40.9g  16%   vxfs  5 yes /var/tmp/Docs
/dev/vgbig/lvol4     51.2g   11.9g   36.8g  24%   vxfs  5 yes /var/tmp/CustomerData
/dev/vgbig/lvol1    204.8g   69.5g  126.8g  35%   vxfs  5 yes /var/opt/ignite
/dev/vg00/lvol7      3702    1895    1793   51%   vxfs  5 yes /usr
/dev/vg00/lvol4       204     168      36   82%   vxfs  5 yes /tmp
/dev/vg00/lvol6      6291    5621     664   89%   vxfs  5 yes /opt
/dev/vg00/lvol5       102      28      72   28%   vxfs  5 yes /home
/dev/vg03/lvol1      15.4g     40    14.4g   0%   vxfs  5  no /FileLibrary
/dev/vgatl8/lvol1  1002.5g  709.8g  290.5g  71%   vxfs  4 yes /support

Select by percentage full:

# bdfmegs -P 70
File-System        Mbytes    Used   Avail %Used Mounted on
/dev/vg00/lvol4       204     168      36   82% /tmp
/dev/vg00/lvol6      6291    5621     664   89% /opt
/dev/vgatl8/lvol1  1002.5g  709.8g  290.5g  71% /support

Deselect vg00

# bdfmegs -N vg00
File-System        Mbytes    Used   Avail %Used Mounted on
/dev/vgbig/lvol5    102.4g   9525    87.1g  10% /var/tmp/crashdumps
/dev/vgbig/lvol3     61.4g     91    57.5g   0% /var/tmp/atldepots
/dev/vgbig/lvol6     4096    2399    1590   60% /var/tmp/Training
/dev/vgbig/lvol2    512.0g  213.5g  279.8g  43% /var/tmp/Packages
/dev/vgbig/lvol7     51.2g   7548    40.9g  16% /var/tmp/Docs
/dev/vgbig/lvol4     51.2g   11.9g   36.8g  24% /var/tmp/CustomerData
/dev/vgbig/lvol1    204.8g   69.5g  126.8g  35% /var/opt/ignite
/dev/vg03/lvol1      15.4g     40    14.4g   0% /FileLibrary
/dev/vgatl8/lvol1  1002.5g  709.8g  290.5g  71% /support

Sort by Avail space (column 4) and sum total:

# bdfmegs -c 4 -s
File-System        Mbytes    Used   Avail %Used Mounted on
/dev/vg00/lvol4       204     168      36   82% /tmp
/dev/vg00/lvol5       102      28      72   28% /home
/dev/vg00/lvol1       298      56     212   21% /stand
/dev/vg00/lvol3       557     327     227   59% /
/dev/vg00/lvol6      6291    5621     664   89% /opt
/dev/vgbig/lvol6     4096    2399    1590   60% /var/tmp/Training
/dev/vg00/lvol7      3702    1895    1793   51% /usr
/dev/vg00/lvol8      10.2g   7018    3200   69% /var
/dev/vg03/lvol1      15.4g     40    14.4g   0% /FileLibrary
/dev/vgbig/lvol4     51.2g   11.9g   36.8g  24% /var/tmp/CustomerData
/dev/vgbig/lvol7     51.2g   7548    40.9g  16% /var/tmp/Docs
/dev/vgbig/lvol3     61.4g     91    57.5g   0% /var/tmp/atldepots
/dev/vgbig/lvol5    102.4g   9525    87.1g  10% /var/tmp/crashdumps
/dev/vgbig/lvol1    204.8g   69.5g  126.8g  35% /var/opt/ignite
/dev/vgbig/lvol2    512.0g  213.5g  279.8g  43% /var/tmp/Packages
/dev/vgatl8/lvol1  1002.5g  709.8g  290.5g  71% /support
-- sum totals ---  2026.4g 1039.4g  941.6g  --- sum totals ---
Show LVM VG versions (on an 11.31 system) # bdfmegs -v
File-System             Mbytes    Used   Avail %Used   Type Vr Lrg VGv Mounted on
/dev/vg00/lvol3           1048     469     574   45%   vxfs  6 yes 1.0  /
/dev/vg00/lvol1           1395     135    1119   11%    hfs na  -- 1.0  /stand
/dev/vg00/lvol8           8388    3032    5314   36%   vxfs  6 yes 1.0  /var
/dev/vg00/lvol7           4194    2385    1794   57%   vxfs  6 yes 1.0  /usr
/dev/vg00/lvol6            524     355     167   68%   vxfs  6 yes 1.0  /tmp
/dev/vg00/lvol5           6553    5477    1067   84%   vxfs  6 yes 1.0  /opt
/dev/vg2.1/lvol1          10.2g    312    9306    3%   vxfs  6 yes 2.1  /mnt2.1
/dev/vg00/lvol4            262       7     252    3%   vxfs  6 yes 1.0  /home
atl1:/var/tmp/Packages   512.0g  213.5g  279.8g  43%    nfs  3  -- n/a  /mnt3
/dev/vg2.2/lvol1           516       2     481    0%   vxfs  7 yes 2.2  /mnt2.2
/dev/vg2.0/lvol1          1024      17     943    2%   vxfs  7 yes 2.0  /mnt2.0


 

 

VxVM example

# bdfmegs -v
File-System                  Mbytes    Used   Avail %Used   Type Vr Lrg Mounted on
/dev/vx/dsk/rootdg/rootvol     1179     340     786   30%   vxfs  5  no /
/dev/vx/dsk/rootdg/standvol     801      60     660    8%    hfs na  -- /stand
/dev/vx/dsk/rootdg/varvol      4292    1646    2480   40%   vxfs  5  no /var
/dev/vx/dsk/rootdg/crashvol    41.0g   4394    34.3g  11%   vxfs  6 yes /var/adm/crash
/dev/vx/dsk/rootdg/usrvol      4669    1666    2814   37%   vxfs  5  no /usr
/dev/vx/dsk/rootdg/tmpvol       524      25     467    5%   vxfs  5  no /tmp
/dev/vx/dsk/rootdg/optvol      5341    2802    2380   54%   vxfs  5  no /opt
/dev/vx/dsk/rootdg/homevol      114       1     105    2%   vxfs  5  no /home
/dev/vx/dsk/rootdg/pwwvol      2252      95    2022    4%   vxfs  6 yes /pww

 

NOTE: The attachment is bdfmegs.txt so the Lithium engine will allow it to be posted. Rename to bdfmegs on your system. Recommended location is /usr/contrib/bin/bdfmegs



Bill Hassell, sysadmin
12 REPLIES
Henry Fauni
Valued Contributor

Re: bdfmegs ver 6.1 available

Thanks, Bill.

support_billa
Valued Contributor

Re: bdfmegs ver 6.1 available

hello,

 

this is a great tool !

 

i know, this is the wrong Community , but is there an initiative to port it to LINUX ?

i ported some tools from HPUX to LINUX and there are some changes, but no so big ones.

 

congratulation to the maintainer !

 

regards

 

support_billa
Valued Contributor

Re: bdfmegs ver 6.1 available

hello,

 

Ver 5.3 - Added -d to toggle ONEK between 1024 and 1000 for divisors
          The default can be changed by editing ONEK

 

 

In HP-UX 11.31 has "bdf" and "df -k" the same output, so i think is better to handle with unix release ( like uname -r ) the division ( HP-UX 11.31 division with 1024 ??? )

 

divison with 1000 is a little bit dizzying because bdfmegs differs from bdf

 

more details you can see in my attachment

 

regards

Bill Hassell
Honored Contributor

Re: bdfmegs ver 6.2 now available

Correct. bdfmegs defaulted to 1000 because it looked a bit more accurate (at least for the first few digits). But you are correct. The more accurate divisor is 1024, so with the newest version (attached), the default is now 1024. Additionally, I have set a default sort order as the first column. bdf by itself has an unpredictable order so grouping all the VGs and lvols together makes a better presentation.



Bill Hassell, sysadmin
support_billa
Valued Contributor

Re: bdfmegs ver 6.2 now available

hello,

 

thx for the new version:

 

i changed following part because i used it very often as "non root-user"

 

# filesystem types allowed
  set -A FSID $(/usr/sbin/fstyp -l)

 

regards

Bill Hassell
Honored Contributor

Re: bdfmegs ver 6.2 now available

You're correct. /usr/sbin isn't always part of an ordinary user's $PATH

Thanks for the pointer. The fixed version is attached



Bill Hassell, sysadmin
Bill Hassell
Honored Contributor

Re: bdfmegs ver 6.2 now available

Minor revision...the PATH list is actually set inside the script but was placed below the fstyp command. It has been moved back to the beginning of the script. Now bdfmegs runs without regard to the current PATH setting.



Bill Hassell, sysadmin
Eshwar123
Occasional Visitor

Re: bdfmegs ver 6.1 available

Hi

 

Please help me

 

I am getting below errors while i am running the script.

 

I am a newbie to unix

 

dcdev01:root:/home/dcl2ux>./bdfmegs.sh
interpreter "/usr/bin/sh" not found
sh: ./bdfmegs.sh:  not found.
dcdev01:root:/home/dcl2ux>./364535.null
interpreter "/usr/bin/sh" not found
sh: ./364535.null:  not found.
dcdev01:root:/home/dcl2ux>

 

Dennis Handly
Acclaimed Contributor

Re: bdfmegs ver 6.1 available: interpreter "/usr/bin/sh" not found

>dcdev01:root:/home/dcl2ux>./bdfmegs.sh
interpreter "/usr/bin/sh" not found

 

Does /usr/bin/sh exist and is it read and executable by all?  And the same with:

ll -d /usr/bin/sh /usr/bin /usr /

Bill Hassell
Honored Contributor

Re: bdfmegs ver 6.1 available: interpreter "/usr/bin/sh" not found

>> interpreter "/usr/bin/sh" not found

 

Although you can't see it, there is probably ^M at the end of every line. This is a very common problem between Windows and Unix systems. When you transferred the script from your PC to the HP-UX system, you probably used ftp and did not choose the ASCII transfer method. Windows adds an extra character to the end of every line (ctrl-M or carriage return). You can fix this in two ways:

 

1. Transfer the file again using ftp but select ASCII rather than BINARY as the transfer method,

 

2. Use dos2ux like this:

 

cd /directory_with_bdfmegs
dos2ux bdfmegs > bdfmegs.fix
mv bdfmegs.fix bdfmegs

Now it will run correctly.

 

I have attached the latest version (6.4).

New features:

 

-- Handles up to zettabytes (kilo mega giga tera peta etta zetta)

-- Identifies read-only filesystems with "*"

-- Added -D to allow stdin piped into bdfmegs. This is used when you have a text file or email message with plain bdf and you want to reformat it with bdfmegs.



Bill Hassell, sysadmin
Robert_Jewell
Honored Contributor

Re: bdfmegs ver 6.1 available: interpreter "/usr/bin/sh" not found

Thanks again for the share, Bill.

 

-Bob

----------------
Was this helpful? Like this post by giving me a thumbs up below!
singh sanjeev
Trusted Contributor

Re: bdfmegs ver 6.1 available: interpreter "/usr/bin/sh" not found

Thank you Bill , Great work !!!
Sanjeev Singh