hdisk mapping to a vSCSi Adapter

Hello,
I have a VIOS System and would like to do mapping some hdisks, hdisk160 until hdisk165 to a vSCSi Adapter. I try to do this in the oem_setup_env like the following:

for i in $(lspv | grep hdisk* | awk {'print $1'};
do
   mkdev -V $i -p vhost20
done

There where a mapping with hdisk16 but this is totally wrong. Can anybody give me some inspiration to realize this? Many thanks!

I don't know where to start

  1. your script wont run at all
  2. you want to map hdiskx-hdisky and not all hdisks on the system
  3. you don't grep this way (hdisk*) just hdisk is enough, and the * is substituted by the shell, grep wont even see it, grep uses regex
    when grep is used for hdisks for example, always use -w option, because hdisk16 would give you hdisk16 and hdisk165 for example
  4. mkvdev alias does not exist in oem_setup_env, it's an alias, you need to run /usr/ios/cli/ioscli mkvdev or set the alias, or run your script as padmin
  5. that's not the way awk works
 awk {'print $1'}
  1. don't use default mapping names, define your own, that's not a must, but makes you life much easier

couldn't test it, but this should work for you

for i in 0 1 2 3 4 5 
do
mkvdev -vdev hdisk16${i} -vadapter vhost20 -dev yourname_${i}
done

you may use "

for ((i=160;i<166;i++))

instead, but this will only work in ksh93

Thank you funksen but there is still a mistake, could you be so kindly and check the code?

$ for i in 0 1 2 3 4 5
> do
> mkvdev -vdev hdisk16${i} -vadapter vhost20
> done

The command's response was not recognized. This may or may not indicate a problem.

$ lsmap -vadapter vhost20
SVSA            Physloc                                      Client Partition ID
--------------- -------------------------------------------- ------------------
vhost20         U8202.E4B.06B4F4P-V1-C327                    0x0000000d

VTD                   NO VIRTUAL TARGET DEVICE FOUND

I've seen that message before when the hdisk is already mapped to another vhost. Try the following (as padmin) to check if hdisk165 is already mapped somewhere.

lsmap -all | grep -w hdisk165

HTH

Hello,
It isn't allready mapped!

---------- Post updated at 02:55 AM ---------- Previous update was at 02:38 AM ----------

I found the problem, the luns which I would like to map are flash copys. The flash copys where stopped so I started them an now the mapping works fine. Thanks a lot!