cancel
Showing results for 
Search instead for 
Did you mean: 

ASM and HP-UX

SOLVED
Go to solution
sen_ux
Valued Contributor

ASM and HP-UX

How can we identify from OS, if a disk is used by Oracle ASM ?

Thanks,
9 REPLIES
Duncan Edmonstone
Honored Contributor
Solution

Re: ASM and HP-UX

Assuming you are on 11iv3 (11.31), you can use the diskowner(1m) command:

e.g.

# diskowner /dev/disk/disk2



# man diskowner

for more details...

HTH

Duncan

HTH

Duncan
sen_ux
Valued Contributor

Re: ASM and HP-UX

Thanks,

What about earlier versions of HP-UX ?

Duncan Edmonstone
Honored Contributor

Re: ASM and HP-UX

If you have access to Oracle support, you should look at article 603210.1

This basically tells you that an ASM disk will have the ASCII string "ORCLDISK" written into bytes 32 to 39 of a disk if it is being or has been used for ASM. In order to identify if a disk is still being used for ASM look at byte 71 and see if it has a "004" in it.

So I don't have an ASM disk to hand to try this on, but I suspect something like this should work (you may have to play with the offsets a little - I'm terrible at making fencepost errors!)

So to identify if its an ASM disk:

od -v -Ad -t c -j 32 -N 8 /dev/rdsk/cXtYdZ

And to see if its still in use:

od -v -Ad -t c -j 71 -N 1 /dev/rdsk/cXtYdZ


HTH

Duncan

HTH

Duncan
Duncan Edmonstone
Honored Contributor

Re: ASM and HP-UX

Hi,

As I didn't have access to a system with ASM on it, I'm interested to know whether the commands I provided actually worked?

Duncan

HTH

Duncan
sen_ux
Valued Contributor

Re: ASM and HP-UX

Hi Duncan,

Sorry for late reply...

I have tesetd your answers in an AIX test box (I dont have a HPUX box to test ASM).

See the output below..

#od -v -Ad -t c -j 32 -N 8 /dev/hdisk4
0000000 O R C L D I S K
0000008
#od -v -Ad -t c -j 71 -N 1 /dev/hdisk4
0000000 003
0000001
#

It is showing the ascii string perfect.. But at 71 it is 003.

Thanks,
Duncan Edmonstone
Honored Contributor

Re: ASM and HP-UX

> #od -v -Ad -t c -j 71 -N 1 /dev/hdisk4
> 0000000 003
> 0000001

OK, so are you completely sure in this case that /dev/hdisk4 is in use by ASM _right now_ (as I said it's only set to 004 if ASM is still using it. If ASM has stopped using the disk it will still have ORCLDISK written into it, but not 004)

Alternatively, it could be a fencepost error on my part - would be interesting to look at a few other bytes around that position... try:

od -v -Ad -t c -j 70 -N 3 /dev/hdisk4

That should show is the byte before/after the one we looked at previously as well...

(as a third alternative, the Oracle support article could be wrong/out of date - I've come across plenty that are, but I have no way to confirm that!)

HTH

Duncan

HTH

Duncan
sen_ux
Valued Contributor

Re: ASM and HP-UX

Disk is still in use by ASM..

SQL> select PATH from v$asm_disk;

PATH
---------------
/dev/rhdisk4

SQL>

See the requested output..

#od -v -Ad -t c -j 70 -N 3 /dev/hdisk4
0000000 001 003 D
0000003
#od -v -Ad -t c -j 65 -N 10 /dev/hdisk4
0000000 020 \0 \0 \0 \0 001 003 D I S
0000010
#

However this is a very good point you have given.. Thanks Duncan..
Duncan Edmonstone
Honored Contributor

Re: ASM and HP-UX

Ah OK, my bad... just looked at the Oracle support article again, and I wasn't paying attention - here's the relevant code snippet from the C code they give as an example:

if (buf[71] != 4) {
printf("This disk %s still used by ASM\n",argv[1]);
return (0);
}
else
printf("This disk %s has been used by ASM\n",argv[1]);


So what this is saying is that if byte 71 _doesn't_ contain 4 (004 from the od output) then it is still in use by ASM, and if it does contain 4, it _was_ in use by ASM - I guess the only way you could check this would be to stop using the disk (I don't know ASM that well but maybe "alter diskgroup XXXX drop disk 'diskname';")

HTH

Duncan

HTH

Duncan
sen_ux
Valued Contributor

Re: ASM and HP-UX

Great.. Thanks Duncan..

SQL> drop diskgroup DISK_GROUP_1 including contents;

Diskgroup dropped.

SQL>

#od -v -Ad -t c -j 71 -N 1 /dev/hdisk4
0000000 004
0000001
#

I am closing this thread..

Thanks,
SEN