Redistribuir los PV links de un VG (HP-UX) — Update

Respecto al post anterior sobre como redistribuir los PV links de un VG sobre los distinctos caminos a los discos, agradezco el comentario de RuBiCK apuntando a la opción -s del comando pvchange:

NAME
   pvchange - change characteristics and access path of a physical volume
   in an LVM volume group

SYNOPSIS
...
   /usr/sbin/pvchange [-A autobackup] -s pv_path
...
     -s  Immediately begin accessing the associated
         physical volume named by pv_path.
...

Usando este comando no es necesario quitar y reañadir los PV links al VG. Ademas de ser mas seguro, tambien se reduce considerablemente el script, quedando asi:

#!/usr/bin/ksh
# Distribuye los PV links sobre las controladoras
set -o nounset

VG=$1
I=0
for PV in $(
   vgdisplay -v $VG | grep "PV Name" |
   grep -v "Alternate Link" | awk '{ print $3 }' )
do

   LISTA_LINKS=$( pvdisplay $PV | grep "PV Name" | awk '{ print $3 }' | sort )
   NUM_LINKS=$( echo $LISTA_LINKS | wc -w )

   NEW=$(( I % NUM_LINKS + 1 ))
   PRI=$( echo $LISTA_LINKS | awk "{ print \$${NEW} }" )

   pvchange -A n -s $PRI
   (( I = I + 1 ))

done
vgcfgbackup $VG

Gracias RuBiCK por la contribución ;-).

1 Responses to “Redistribuir los PV links de un VG (HP-UX) — Update”


Leave a Reply




Close
Powered by ShareThis