Solaris ZFS  migration

- Migrating ZFS to another array

#!/usr/bin/bash
set -e
if [ ! $1 ]
then
    echo "USAGE: $0 <pool name>"
    exit 1
fi
__POOL__=$1
__LUNS_NEW__=( c3t60000970000292603494533032323534d0 c3t60000970000292603494533032323438d0 )
__LUNS_OLD__=`zpool status ${__POOL__} | grep c3t | awk '{print $1}'`
p=0
for i in ${__LUNS_OLD__}
do
    zpool attach ${__POOL__} ${i} ${__LUNS_NEW__[$p]}
    p=$[p+1]
done


detach old storage array LUNs after resilver is done:

#!/usr/bin/bash
set -e
if [ ! $1 ]
then   
    echo "USAGE: $0 <pool name>"   
    exit 1
fi
__POOL__=$1
__STUFF__=( `zpool status ${__POOL__} | grep ONLINE | egrep -v "state|mirror|${__POOL__}" | awk '{print $1}'` )
for i in ${__STUFF__[@]}
do   
    __REV__=`luxadm display /dev/rdsk/${i}s2 | grep -i rev | awk '{print $2}'`   
    if [ ${__REV__} = "5773" ] #5773 DMX #5874 VMAX   
    then       
        echo "${i} is from rev ${__REV__} will detach..."       
        zpool detach ${__POOL__} ${i}   
    else       
        echo "${i} is from rev ${__REV__} will leave as is..."   
    fi
done