- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Script to list all unused disks on the Server.
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2005 01:02 AM
05-26-2005 01:02 AM
I am looking for a shell script which should generate a report of ONLY all unused disk attached on our HP-UX server.
We have more than 200 JBOD disk attached to the server, previously I was using SAM to get the list of all unused disks. But now I want a script to do the same.
Thanks in advance for your anticipated help.
Gulam.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2005 01:06 AM
05-26-2005 01:06 AM
Re: Script to list all unused disks on the Server.
We can get all file system usage informations with bdf or df -h.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2005 01:17 AM
05-26-2005 01:17 AM
Re: Script to list all unused disks on the Server.
So that I can utilize those unused disks for creating more filesystes.
bdf will not show unused disks.
Thanks.
Gulam.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2005 01:20 AM
05-26-2005 01:20 AM
Re: Script to list all unused disks on the Server.
Use sam to do the list one more time.
Then go to the menu and try these options:
options
view sam log
set it to commands only.
You will see the command which you can copy and paste into a script.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2005 01:25 AM
05-26-2005 01:25 AM
Solutionfor i in `ioscan -funC disk |grep dsk |grep -v c0t0d0 |awk '{print $1}'`
do
DISK=`strings /etc/lvmtab |grep $i`
if [ "$DISK" = "" ]; then
echo "$i is not part of a volume group..."
fi
done
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2005 01:26 AM
05-26-2005 01:26 AM
Re: Script to list all unused disks on the Server.
Do you want a comparison of what the ioscan -fnCdisk reports against the vgdisplay output?
What about disks that are used via VxVM?
Is MC/SG in the mix? If so then disks activated on one system will not be readily seen on the other system.
These are just a couple of avenues to pursue. Need to get more info about the environment.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2005 01:28 AM
05-26-2005 01:28 AM
Re: Script to list all unused disks on the Server.
Not knowing what disks belong to what is a serious issue for an administrator. If you have a database or some other application that is using raw disk drives, and that fact is not documented, then you have some serious potential to destroy those databases and or applications. I have seen this done time and time again by admins that didn't have a clue, couldn't read or didn't want to be bothered reading the system documentation and then went on to assign a disk drive to a file system when that disk drive was part of a database. OOPS - database is now toast!
Learn from others mistakes and keep concise documentation on your systems!
You can't write a script for this, you either know or don't know, and if you don't know, well then you had better learn.
Use things like print_manifest, vgdisplay -v, bdf, ioscan -fn, documentation from your DBA's, ...
live free or die
harry d brown jr
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2005 01:29 AM
05-26-2005 01:29 AM
Re: Script to list all unused disks on the Server.
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2005 02:18 AM
05-26-2005 02:18 AM
Re: Script to list all unused disks on the Server.
The below script will compare the output of 'ioscan -kfnC disk' and 'strings /etc/lvmtab' and output the disks that are not in lvmtab.
#!/usr/bin/sh
ioscan -kfnC disk | grep dsk | awk '{print $1}' > /var/tmp/disk.list
for DISK in $(cat /var/tmp/disk.list)
do
strings /etc/lvmtab | grep -q ${DISK}
if [[ $? != 0 ]] ; then
echo "Disk ${DISK} is not part of a VG"
fi
rm -f /var/tmp/disk.list
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2005 02:55 AM
05-26-2005 02:55 AM
Re: Script to list all unused disks on the Server.
As others have observed, i too would join the general concensus that it would be hard to tell whether the disk would be really used or unused. Because there are applications that could use the device in raw format.
But, alas as far as LVM is concerned you could perform the following test...
ioscan -funC disk |grep dsk | awk '{print $1}' | while read x
do
pvdisplay $x 1> /dev/null 2> /dev/null
if [ $? -eq 0 ]
then
echo "$x USED"
else
echo "$x UNUSED"
fi
done
But, even if this tells you used...the sure way is to grep it in /etc/lvmtab, because..after removing a disk from a VG, many a time we might miss ysing pvremove on certain disk. so there is no hard and fast rule here either.
As far as wether the disk could be used by vxvm is concerned.. we need to eloborate the above test further...using "vxprivutil" or...
"strings -t d /dev/dsk/c0t1d0 | grep VMDB"
Like i said there is no hard and fast rule.. we need to dvelve further to make the script impeccable...
Hope this helped :)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2005 04:51 AM
05-26-2005 04:51 AM
Re: Script to list all unused disks on the Server.
One more option. None of the prior inline scripts will identify alternate links that haven't been added to the volume groups - a bad situation to say the least. To find disks that are not part of the LVM you can run the following:
ioscan -funC disk | grep dsk | awk '{print $1}' | while read dsk
do
vgid=$(echo 0x2010?2X| adb ${dsk} | expand | tr -d " " | sed 's/2010://g')
[[ ${vgid} = "00" ]] && echo ${dsk}
done
HTH;
Doug
------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html