Just to be clear, I know that there are some AIX bundled commands like mkvgdata and restvg
which can do much better by saving/restoring the data structure of a VG, in order to
clone it, or recreate it on any host you like, but that is not my point here.
If you’ve got two LPARs, say one is the production LPAR, and the other a dev LPAR,
and they should have the exact same FS on their VGs, if that’s not the case,then you
can’t just use mkvgdata, because you already have a identical VG with *almost* the same FS
.
Here we will just write down what is needed to create/complete what is missing
on the target host, choose the line we need and copy/paste on the other LPAR.
Script:
——

lsvg -o |grep -v rootvg| while read vg
do
echo "\n$vg:\n======"
lsvg -l $vg |grep -w jfs. |sort -k7| while read lv type lps pps pvs state fs
do
accessrights=$(ls -ld $fs | awk '{print $3":"$4}')
echo "mklv -y $lv -t $type $vg $lps && crfs -d $lv -v $type -m $fs \
-A'yes' -p'rw' -a agblksize='4096' -a logname='INLINE' && mount $fs\
&& chown $accessrights $fs"
done
done

Example:
——-

appsvg:
======
mklv -y lvapps -t jfs2 appsvg 1 && crfs -d lvapps -v jfs2 -m /apps \
-A’yes’ -p’rw’ -a agblksize=’4096′ -a logname=’INLINE’ && mount /apps \
&& chown root:system /apps
mklv -y lvdata -t jfs2 appsvg 1 && crfs -d lvdata -v jfs2 -m /data \
-A’yes’ -p’rw’ -a agblksize=’4096′ -a logname=’INLINE’ && mount /data \
&& chown root:system /data
datavg:
======
mklv -y lvdata -t jfs2 appsvg 1 && crfs -d lvapps -v jfs2 -m /data \
-A’yes’ -p’rw’ -a agblksize=’4096′ -a logname=’INLINE’ && mount /data \
&& chown root:system /data

Just copy/paste the result or the only lines you need on the target host, and you’re good to go !