Friends here is a small script which can pull AIX OS LVM information of the server and if want it in a file re-direct the output of the script into a file.This is best useful when your are doing system reboots and upgrades.
Script:
#!/bin/ksh
#
# Simple script to document LVM configurations.
#
exec 2>&1
printf "AIX DISK AND LVM INFORMATION\n"
printf "*********************************************************\n"
printf "\nDF\n"
printf "==========================\n"
df -k
printf "\nVOLUME GROUPS:\n"
printf "==========================\n"
lsvg
printf "\n\nPHYSICAL VOLUMES:\n"
printf "==========================\n"
lspv
printf "\n\nPVs BY VOLUME GROUP\n"
printf "==========================\n"
lsvg | while read VG; do
VGLIST="$VGLIST $VG"
printf "\n$VG\n"
printf "--------------------------\n"
lspv | grep $VG
done
printf "\n\nPV INFORMATION:\n"
printf "==========================\n"
lspv | while read PV; do
printf "\n$PV\n"
printf "--------------------------\n"
lspv $PV
done
printf "\n\nVG INFORMATION\n"
printf "==========================\n"
for VG in $VGLIST; do
printf "\n$VG\n"
printf "--------------------------\n"
lsvg $VG
lsvg -l $VG
done
printf "\n\nLV INFORMATION\n"
printf "==========================\n"
for VG in $VGLIST; do
printf "\nVolume Group: $VG\n"
printf "--------------------------\n"
lsvg -l $VG | egrep -v "^$VG:" | egrep -v "^LV NAME" | while read LV JUNK;
do
printf "\nLogical Volume: $LV\n"
printf "--------------------------\n"
lslv $LV
done
done
#
# Simple script to document LVM configurations.
#
exec 2>&1
printf "AIX DISK AND LVM INFORMATION\n"
printf "*********************************************************\n"
printf "\nDF\n"
printf "==========================\n"
df -k
printf "\nVOLUME GROUPS:\n"
printf "==========================\n"
lsvg
printf "\n\nPHYSICAL VOLUMES:\n"
printf "==========================\n"
lspv
printf "\n\nPVs BY VOLUME GROUP\n"
printf "==========================\n"
lsvg | while read VG; do
VGLIST="$VGLIST $VG"
printf "\n$VG\n"
printf "--------------------------\n"
lspv | grep $VG
done
printf "\n\nPV INFORMATION:\n"
printf "==========================\n"
lspv | while read PV; do
printf "\n$PV\n"
printf "--------------------------\n"
lspv $PV
done
printf "\n\nVG INFORMATION\n"
printf "==========================\n"
for VG in $VGLIST; do
printf "\n$VG\n"
printf "--------------------------\n"
lsvg $VG
lsvg -l $VG
done
printf "\n\nLV INFORMATION\n"
printf "==========================\n"
for VG in $VGLIST; do
printf "\nVolume Group: $VG\n"
printf "--------------------------\n"
lsvg -l $VG | egrep -v "^$VG:" | egrep -v "^LV NAME" | while read LV JUNK;
do
printf "\nLogical Volume: $LV\n"
printf "--------------------------\n"
lslv $LV
done
done
0 blogger-disqus:
Post a Comment