HP-UX 11i v3 LVM New Features in HP-UX 11i v3 (September 2009)
20
Compact, Parsable Command Output
en enhanced to produce a compact and easily parsable output. A new option -F
is introduced in pvdisplay, vgdisplay ,and lvdisplay commands. The commands generate colon-separated fields as
ut can be split across multiple lines. The output
can include new keys or values in the future. The positioning of a given key and value pair is not
ed. If a key is deprecated, its associated value is set to NAM (key=NAM). HP recommends all user scripts
Examples
• ogical volume name and field name as specified in the
lvdisplay -F output, the following script
the value for the given key:
LVDISPLAY_F_OUTPUT_KEY=$2;
LV_NAME | /usr/bin/awk -F':' '{for(i=1;i<=NF;i++) print $i;}' | \
info /dev/vgtest/lvol1 lv_size
, the following script lists all the physical volume belonging to the volume group
_in_vg
vgdisplay -Fv $VG_NAME | sed -n -e "s/^.*pv_name=\([^:.]*\):.*$/\1/p"
# get_pv_in_vg /dev/vgtest
• Perl Sample example: Given a physical volume name and field name as specified in the
pvdisplay -F output ,
the following script extracts the value for the given key:
# cat get_pvinfo
#!/usr/bin/perl
my $PV_NAME = $ARGV[0];
my $PVDISPLAY_KEY = $ARGV[1];
my %pvdisplay_hash = ();
Usability Enhancements
LVM display commands have be
key=value[,value...]:key=value[,value].
The
-F option is for use in scripts. The resulting command outp
guarante
depending on LVM display commands’ output to be modified to use
-F option.
Given a l
extracts
# cat get_lvinfo
#!/bin/sh
_NAME=$1; LV
lvdisplay -F $
awk /$LVDISPLAY_F_OUTPUT_KEY/ | cut -f2 -d "="
# get_lv
40
• Given a volume group name
# cat get_p
v
#!/bin/sh
VG_NAME=$1;
/dev/dsk/c11t0d5
/dev/dsk/c7t0d1