#!/bin/ksh93
# do not run this
# this means you
# methods are completely unsupported by anyone
# you probably want to just do this manually
# for reference, we are moving testvgone into testvgtwo
# testvgone has only testlvone and loglv04
# /testfsone
# get some infos
fslist=$(lsvg -l testvgone|awk '$NF~/^\//{print$NF}'|sort)
lvlist=$(lsvg -l testvgone|awk '$NF~/^\//{print$1}')
loglist=$(lsvg -l testvgone|awk '$2~/jfs2?log/')
# back up /etc/filesystems
print "saving /etc/filesystems"
cp /etc/filesystems /etc/filesystems.save
# make mapfiles for testvgone
print "making mapfiles"
mkvgdata -m testvgone
print "Check your work before proceeding. Then press enter."
read X
# umount all filesystems in testvgone
for fs in $fslist;do
umount $fs
done
print "Check mount status before proceeding. Then press enter."
read X
# export testvgone
print "varyoff and exporting testvgone"
varyoffvg testvgone
exportvg testvgone
# give testvgone's disks to testvgtwo
print "adding testvgone disks to testvgtwo"
extendvg -f testvgtwo hdiskpower38 hdiskpower39
# recreate testvgone's lvs in testvgtwo
for lv in $lvlist;do
print "recreating $lv"
lps=`cat /tmp/vgdata/testvgone/$lv.map|wc -l`
mklv -y $lv -m /tmp/vgdata/testvgone/$lv.map testvgtwo $lps
done
# don't forget the loglv
# use the right name
# i have not bothered to code this out for if you have multiple loglv in a vg
# so check that out!
mklv -t jfslog -y loglv04 -m /tmp/vgdata/testvgone/loglv04.map testvgtwo 1
# bring back the original /etc/filesystems
print "restoring /etc/filesystems"
cp /etc/filesystems.save /etc/filesystems
# update lvcb
for fs in $fslist;do
print "getting info for $fs from /etc/filesystems"
mount=`grep -p $fs: /etc/filesystems|awk '$1=="mount" {print $NF}'`
options=`grep -p $fs: /etc/filesystems|awk '$1=="options" {print $NF}'`
account=`grep -p $fs: /etc/filesystems|awk '$1=="account" {print $NF}'`
log=`grep -p $fs: /etc/filesystems|awk '$1=="log" {print $NF}'`
lv=$(grep -p $fs: /etc/filesystems|awk '$1=="dev" {print $NF}'|awk -F '{print $NF}')
/etc/putlvcb -f log=${log}:mount=${mount}:options=${options}:account=${account} $lv
/etc/putlvcb -L $fs $lv
done
# mount them
for fs in $fslist;do
print "mounting $fs"
mount $fs
done