Operating System - HP-UX
1833758 Members
2183 Online
110063 Solutions
New Discussion

how to find unused disk devices in hpunix

 
sanwin
Frequent Advisor

how to find unused disk devices in hpunix

Hi,
How to find the unused disk devices in hpunix.
My requirement is something like i hav to create a new VG with the unused disks available.

Please help me with your comments.

regards,
sanwin.
6 REPLIES 6
Pete Randall
Outstanding Contributor

Re: how to find unused disk devices in hpunix

SAM can be very helpful in this. It will present you with a list of what it considers to be unused disks - any disk not already in use by LVM.


Pete

Pete
Jeeshan
Honored Contributor

Re: how to find unused disk devices in hpunix

run ioscan -fnC disk

check all disks are used or not.

#pvdisplay /dev/dsk/cXtXdX

a warrior never quits
Ivan Krastev
Honored Contributor

Re: how to find unused disk devices in hpunix

Find all devices in use:
# strings /etc/lvmtab | grep dsk > used.txt

Get all devices, presented to system
#ioscan -fnC disk > all.txt

See what is not used:
#grep -vf used.txt all.txt > new.txt


regards,
ivan

Matti_Kurkela
Honored Contributor

Re: how to find unused disk devices in hpunix

A disk can be used for a filesystem, or it can be used for other things, like raw databases.

In HP-UX, it is generally recommended to setup LVs for raw databases too, so that the databases will refer to the disks using /dev/vg*/rlvol*, not /dev/rdsk/c*t*d*. However, this is just a recommendation: someone MAY have set up a raw database to use a plain raw disk, bypassing the LVM layer entirely.

To identify the VGs used by various mounted filesystems, use the command "bdf" or "mount".
To see the PVs used by the VGs, use "vgdisplay -v " or "strings /etc/lvmtab".

Using the information produced by these commands, you can create a list of PVs (=disk devices) that *are* in use. The command "ioscan -fnCdisk" lists all the disks detected by the system: comparing this output to your list you can identify the disks that are not used by currently active VGs.

To see whether or not a disk is currently used by something other than a filesystem, you could use the "fuser" command.
"fuser /dev/rdsk/*" should reveal if e.g. a database engine is currently accessing a disk as a raw database.
(WARNING: this won't detect databases that are currently shutdown.)

MK
MK
Rita C Workman
Honored Contributor

Re: how to find unused disk devices in hpunix

All great answers........but the first thing I might ask:

What is your disk environment?

Because, if it's some direct connected disk to the host/server (good old JBOD), then you will see the disk, and all the commands folks have just given you will help.

But, if your disk is presented from a SAN, then you may have tons of disk that are not mapped and/or not masked to your host/server. In this case...you won't see them until they are !!

Just a thought,
Rgrds,
Rita
Sajjad Sahir
Honored Contributor

Re: how to find unused disk devices in hpunix

ioscan -fnc disk is ok but one more thing
u have to identify which is lun number
for example some disk present from storage has same lun ( consider c0t6d0 and c0t7d0)
both we will consider as the one disk
so u are using only one time pvcreate it will effect second one also
in strings /etc/lvmtab file u are seeing c0t6d0 not c0t7d0
i mean u can't use second one. because it is already used through c0t6d0, if u are using second one it will effect first one also
because both are considering as one disk

sajjad