Operating System - HP-UX
1751716 Members
5671 Online
108781 Solutions
New Discussion юеВ

Re: minor script question

 
SOLVED
Go to solution
Chris Fadrowski
Super Advisor

minor script question

I have a script that i use as DR that creates the disks..

for DISK in `ls /dev/rdsk`
do
[ "${DISK}" != c3t6d0 ] && pvcreate -f /dev/rdsk/${DISK}
done

i am confused by the "c3t6d0" statement. Can someone help me disect this so i understand it better? It's not going to label all disks c3t6d0?
5 REPLIES 5
Kent Ostby
Honored Contributor
Solution

Re: minor script question

Basically, it will do a pvcreate on all the disks that ARE NOT c3t6d0.

I'm suspecting that is the root disk on your system.

Best regards,

Kent M. Ostby
"Well, actually, she is a rocket scientist" -- Steve Martin in "Roxanne"
Chris Fadrowski
Super Advisor

Re: minor script question

Exactly. thank you.. the ! must mean the exception. Do you know how i could put more than one root disk in this?

could i do this;

[ "${DISK}" != c3t6d0 c3t7d0 c3t8d0 ] && pvcreate -f /dev/rdsk/${DISK}

John Carr_2
Honored Contributor

Re: minor script question

Hi

type lssf /dev/dsk/c3t6d0

it will probably come back with sdisk card instance 3 SCSI target 6 LUN 0

this helps you identify which disk it is and what controller and target address it operated by.

:-) John.
MANOJ SRIVASTAVA
Honored Contributor

Re: minor script question

Chris

Do a man ksh

this will do a pvcreate on all disks other than c3t6d0 which essentially should be root volume or something like that , there are more ways to get the list of the newly accquired disks for which pvcreate is to be run.



Manoj Srivastava
Rodney Hills
Honored Contributor

Re: minor script question

Regarding your multiple disk test question-

You could use-
["${DISK} = c3t6d0 ] && continue
["${DISK} = c3t7d0 ] && continue
["${DISK} = c3t8d0 ] && continue
pvcreate -f /dev/rdsk/${DISK}

Or you could use-

case ${DISK} in
c3t6d0|c3t7d0|c3t8d0) continue;;
*) pvcreate -f /dev/rdsk/${DISK};;
esac

HTH

-- Rod Hills
There be dragons...