Script to unmirror a rootvg image
Posted by steve on 02 Jun 2012 in Scripts and One Liners
#!/bin/ksh
#
# This small script will unmirror a rootvg image before starting a mksysb.
# Note: Written to work with 2 mirrored copies, will need amending for 3 way mirrors.
#
mkszfile
cp /image.data /tmp/image.data
awk '{
if ( $0 ~ "COPIES= 2" ) {
print " COPIES= 1"
MIRRORED = "YES"
next
}
if ( $0 ~ "COPIES= 1" ) {
MIRRORED = "NO"
}
if ( $0 ~ "PP=" ) {
if ( MIRRORED == "YES" ) {
NEW_PP = ( $2 / 2 )
print " PP= " NEW_PP
}
else { print $0 }
}
else { print $0 }
}' /tmp/image.data > /image.data