Operating System - HP-UX
1834089 Members
2312 Online
110063 Solutions
New Discussion

How to find the unused Lun.

 
SOLVED
Go to solution
Makesh Annamalai
Frequent Advisor

How to find the unused Lun.

Hey All,

I have about 100 Luns in the servers and i just got new Lun of 50GB from the EVA. How do i find the unused Lun in the server . Is there a way to find it.

Answers are welcome with High Points.. Pls Help in this regards.
12 REPLIES 12
AwadheshPandey
Honored Contributor

Re: How to find the unused Lun.

Try this,

#ioscan -funCdisk > /tmp/used_disk_list
#ioscan -fnCdisk
#insf -eCdisk > /tmp/unused_disk_list
#diff /tmp/unused_disk_list /tmp/used_disk_list

Awadhesh
It's kind of fun to do the impossible
AwadheshPandey
Honored Contributor
Solution

Re: How to find the unused Lun.

Try this,

#ioscan -funCdisk > /tmp/used_disk_list
#ioscan -fnCdisk
#insf -eCdisk
#ioscan -fnCdisk> /tmp/unused_disk_list
#diff /tmp/unused_disk_list /tmp/used_disk_list

Awadhesh
It's kind of fun to do the impossible
Luk Vandenbussche
Honored Contributor

Re: How to find the unused Lun.

A disk that is used is member of a volumegroup.
so check for each disk if it contains VG information

vgdisplay /dev/dsk/cxtydz
Makesh Annamalai
Frequent Advisor

Re: How to find the unused Lun.

I can't check each disk right?
Makesh Annamalai
Frequent Advisor

Re: How to find the unused Lun.

Awadesh !

Thanks for that solution. But what if the installation the spl file is done before capturing the Used Disk info ?
Bill Hassell
Honored Contributor

Re: How to find the unused Lun.

If you have already run ioscan without -k and then insf, discovering the new LUN will be very difficult. If you are using a database (Oracle, Informix, Sybase) or other application that uses raw disk partitions, you will have to get an exact inventory of the currently active raw disks. If you are sure that all of active LUNs are used in a volume group, you can use pvdisplay on each LUN to see if it is assigned to a VG.

Another way is to list the disk device files by date order (date of creation). Use this command:

ll -t /dev/dsk/ | head -5

The most 5 recently created disk devices will be displayed at the top. You can use pvdisplay on the most recent device file to confirm that it is unused.


Bill Hassell, sysadmin
AwadheshPandey
Honored Contributor

Re: How to find the unused Lun.

Then u need to check all the file systems/volume groups/disk groups etc to find used devices.
in case of LVM you can do
# for vg in `vgdisplay|grep "VG Name"|awk '{print $3}'`
> do
> vgdisplay -v $vg |grep "PV Name"
> done
PV Name /dev/dsk/c1t15d0
PV Name /dev/dsk/c3t15d0
PV Name /dev/dsk/c13t0d0
PV Name /dev/dsk/c12t5d5

Awadhesh
It's kind of fun to do the impossible
AwadheshPandey
Honored Contributor

Re: How to find the unused Lun.

you can use strings /etc/lvmtab also to view used disks.
It's kind of fun to do the impossible
Juan M Leon
Trusted Contributor

Re: How to find the unused Lun.

I Like this scripot because it tells me the basic disk information such as disk name, size, and vg associated.

You can try this script. it is simple for and awk combination.
Your output will something like this

./ioscan.sh
Checking 0/3/1/0/4/0
/dev/rdsk/c6t0d7: 0.54GB /dev/vg03
/dev/rdsk/c6t1d0: 0.54GB /dev/vg04
/dev/rdsk/c6t0d0: 9.77GB /dev/vg01
/dev/rdsk/c6t0d1: 9.77GB /dev/vg01
/dev/rdsk/c6t0d2: 9.77GB /dev/vg01
/dev/rdsk/c6t0d3: 9.77GB /dev/vg01
/dev/rdsk/c6t0d4: 9.77GB /dev/vg01
/dev/rdsk/c6t0d5: 9.77GB /dev/vg01
/dev/rdsk/c6t1d1: 9.77GB /dev/vg01
/dev/rdsk/c6t1d2: 9.77GB /dev/vg01
/dev/rdsk/c6t0d6: 11.24GB /dev/vg02
Checking 0/4/1/0/4/0
/dev/rdsk/c4t0d7: 0.54GB /dev/vg03
/dev/rdsk/c4t1d0: 0.54GB /dev/vg04
/dev/rdsk/c4t0d0: 9.77GB /dev/vg01
/dev/rdsk/c4t0d1: 9.77GB /dev/vg01
/dev/rdsk/c4t0d2: 9.77GB /dev/vg01
/dev/rdsk/c4t0d3: 9.77GB /dev/vg01
/dev/rdsk/c4t0d4: 9.77GB /dev/vg01
/dev/rdsk/c4t0d5: 9.77GB /dev/vg01
/dev/rdsk/c4t1d1: 9.77GB /dev/vg01
/dev/rdsk/c4t1d2: 9.77GB /dev/vg01
/dev/rdsk/c4t0d6: 11.24GB /dev/vg02


Let me know if you like it.
Sandman!
Honored Contributor

Re: How to find the unused Lun.

Newly added LUNs will show up in the /var/adm/syslog/syslog.log file. So if you remember when you added them then you could grep for that days' date and the string "sdisk" in the syslog file to figure out the LUNs which were added.
Ronald Schwartz_1
Frequent Advisor

Re: How to find the unused Lun.

I use the following to get information about the un-used disks.

for dsk in /dev/dsk/c*
do
if ! pvdisplay $dsk > /dev/null 2>&1
then
echo "$dsk NOT IN USE"
diskinfo `echo $dsk|sed 's/dsk/rdsk/g'`
fi
done
Oviwan
Honored Contributor

Re: How to find the unused Lun.

Hey

a bit too late but if you have hpux 11.31 you can use this:
#scsimgr -p get_attr all_lun -a device_file -a wwid

then you can compare the WWID with the EVA.

Regards