Skip to content

PHD Consulting LLC

Sections
Personal tools
You are here: Home » Downloads » VDF Enhancement, PHDF
 

PHDF

An enchancement for VDF

This script enchances the output from vdf and comibines your local vmfs name with the vmhba?:?:?:? name.

Normal output from vdf shows only the vmhba names.

root@usfpkesx2 phd-bin]# vdf -h
Filesystem Size Used Avail Use% Mounted on /dev/sda3 2.4G 2.2G 147M 94% / /dev/sda1 45M 12M 31M 27% /boot none 251M 0 250M 0% /dev/shm /dev/sda2 9.8G 2.2G 7.1G 24% /u vmhba0:0:0:6 54G 22G 31G 42% /vmfs/vmhba0:0:0:6 vmhba1:0:0:1 411G 277G 133G 67% /vmfs/vmhba1:0:0:1 vmhba1:1:0:1 102G 7.1M 102G 0% /vmfs/vmhba1:1:0:1 [root@usfpkesx2 phd-bin]#

 

Output from phdf (think as PH, DF) shows both names.

[root@usfpkesx2 phd-bin]# ./phdf
Filesystem Size Used Avail Use% Mounted on /dev/sda3 2.4G 2.2G 147M 94% / /dev/sda1 45M 12M 31M 27% /boot none 251M 0 250M 0% /dev/shm /dev/sda2 9.8G 2.2G 7.1G 24% /u vmhba0:0:0:6 54G 22G 31G 42% /vmfs/vmhba0:0:0:6 (LOCAL) vmhba1:0:0:1 411G 277G 133G 67% /vmfs/vmhba1:0:0:1 (CAB1) vmhba1:1:0:1 102G 7.1M 102G 0% /vmfs/vmhba1:1:0:1 (BACKUPS)

 

Download and put this script in your /usr/bin directory on your ESX host.
Don't forget to change the permissions, chmod 755 /usr/bin/phdf

Or just putty into your ESX host, and vi /usr/bin/phdf

and insert the following code.


#!/usr/bin/perl
# PHD Consulting llc
# www.p2v.net

# This script will show you vdf output with your
# local names of the /vmfs/ mounts.
# Default is with -h (human readable)

my $VDF="/usr/sbin/vdf";
my $VT="/usr/sbin/vmkfstools";
my $DEF="-h";

my @output = `$VDF $DEF`;
foreach $line (@output) {
        chomp($line);
        if ($line =~ /vmhba/) {
                my ($dev,$size,$used,$free,$pfree,$path) = split(/\s+/,$line);
                $info = `$VT -l $path`;
                $info =~ /Name: ([^\s]*).*/;
                print "$line ($1)\n";
        } else {
                print $line."\n";
        }
}



Last modified 2005-07-17 05:51 AM
 

Powered by Plone

This site conforms to the following standards: