Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to change the hdisk names 1

Status
Not open for further replies.

cccompton

MIS
Feb 9, 2005
5
US
I am new to AIX 5.2 and would like to have a procedure validated by those with more experience.

I have just migrated a database from one set of EMC disks (ie hdiskpower0->40) to another set (ie. hdiskpower41->81). I mirrored the logical volumes, split the mirrors off the original set of disks, removed the original disks from the volume group, then removed disks from the server. This went very well.

Because we use EMC BCVs to replicate data between production and test systems, I would really like the hdiskpower0 on "prod" to map to hdiskpower0 on "test", not hdiskpower41. In short, I want to change the name of hdiskpower41 to hdiskpower0.

Here is what I was thinking of doing:
1) exportvg dbvg
2) rmdev -dl hdiskpowerN
3) powermt remove adapter=all
4) rmdev -dl hdiskN
5) rmdev -dl fscsiN
6) rmdev -l powerpath0
7) rmdev -l fcsN
At this point I think all record of the hdiskpowerN will be gone. So, I attempt to re-discover them:
8) emc_cfgmgr
9) powermt config

Finally, here are my questions. If I do the above:
a) will the disks be numbered beginning with hdiskpower0 or will it still use the name hdiskpower41?
b) will the disks be in the same numerical order?
c) most importantly, if the previous 2 questions are affirmative, can I do an "importvg" and recover the logical volumes and data with no problems?

I'll be gratefull for any comments.
 
If you really wanna rename the hdisks, here's a script that will do the job:

#!/bin/ksh
# Syntax: mvhdisk <CurrentName> <NewName>
#

file=/tmp/.mvhdisk.0
file2=/tmp/.mvhdisk.1

lspv | grep $1 > /dev/null 2>&1
if [$? -ne 0]
then
echo mvhdisk: Cannot find $1 in the device configuration database
exit -1
fi
lspv | grep $2 > /dev/null 2>&1
if [ $? -eq 0 ]
then
echo mvhdisk: $2 already exists in the device configuration database
exit -1
else
odmget -q name=$1 CuAt > $file
odmdelete -q name=$1 -o CuAt > /dev/null 2>&1
odmget -q value=$1 CuAt >> $file
odmdelete -q value=$1 -o CuAt > /dev/null 2>&1
odmget -q name=$1 CuDep >> $file
odmdelete -q name=$1 -o CuDep > /dev/null 2>&1
odmget -q name=$1 CuDv >> $file
odmdelete -q name=$1 -o CuDv > /dev/null 2>&1
odmget -q value3=$1 CuDvDr >> $file
odmdelete -q value3=$1 -o CuDvDr > /dev/null 2>&1
odmget -q name=$1 CuVPD >> $file
odmdelete -q name=$1 -o CuVPD > /dev/null 2>&1
sed "s/$1/$2/g" $file > $file2
odmadd $file2
mv -f /dev/$1 /dev/$2
mv -f /dev/r$1 /dev/r$2
savebase
echo $1 changed
rm /tmp/.mvhdisk*
fi

greetz

R.
 
hi RMGBELGIUM,
you are really a expert. i am looking for the method to change the hdisk name for a loooong time.
but i have a small question about this script.
my tow aix boxes are running the hacmp, for some reasons, we got the different hdisk names of the shared vg on both nodes in our stroage device FastT 700.
i am wondering if i can use this script to fix the problem and keep the same hdisk name on both nodes.

thank you very much!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top