HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- script to find the unused disk
Operating System - HP-UX
1833995
Members
3932
Online
110063
Solutions
Forums
Categories
Company
Local Language
back
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
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- 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-09-2006 10:58 PM
05-09-2006 10:58 PM
script to find the unused disk
Hi ,
Any has a script to find the unuse disk in system.
Thx!
Ashan
Any has a script to find the unuse disk in system.
Thx!
Ashan
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2006 11:17 PM
05-09-2006 11:17 PM
Re: script to find the unused disk
No script with me, but following code should
do it.
for i in $(ls -1 /dev/dsk/)
do
pvdisplay /dev/dsk/${i}
vg_name=$(pvdisplay /dev/dsk/${i}|awk '/VG Name/ {print $NF}')
stat=$?
if [ ${stat} -eq 0 ];then
echo "/dev/dsk/${i} - ${vg_name}"
else
echo "/dev/dsk/${i} not used"
fi
This will not take care, if a disk is used as raw device. Only apps can tell about it then.
do it.
for i in $(ls -1 /dev/dsk/)
do
pvdisplay /dev/dsk/${i}
vg_name=$(pvdisplay /dev/dsk/${i}|awk '/VG Name/ {print $NF}')
stat=$?
if [ ${stat} -eq 0 ];then
echo "/dev/dsk/${i} - ${vg_name}"
else
echo "/dev/dsk/${i} not used"
fi
This will not take care, if a disk is used as raw device. Only apps can tell about it then.
There is no substitute to HARDWORK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2006 11:56 PM
05-09-2006 11:56 PM
Re: script to find the unused disk
Hi,
You can also use SAM to check unused disks
sam -> disks and filesystems -> disks and devices .
Then save to file from the options.
But mind you as mentioned above if a disk is directly used - as raw disk without configuring into LVM then it wont be known to SAM.
Also from the disks in the Volume groups already configured there may be free space in the VGs. Youcan find it as below
vgdisplay | egrep -i 'VG Name|PE Size|Free PE' | awk 'BEGIN {print "VGname Free_space(MB)"} {a=$NF;getline;b=$NF;getline;c=$NF;print a,b*c}'
Regards,
Ninad
You can also use SAM to check unused disks
sam -> disks and filesystems -> disks and devices .
Then save to file from the options.
But mind you as mentioned above if a disk is directly used - as raw disk without configuring into LVM then it wont be known to SAM.
Also from the disks in the Volume groups already configured there may be free space in the VGs. Youcan find it as below
vgdisplay | egrep -i 'VG Name|PE Size|Free PE' | awk 'BEGIN {print "VGname Free_space(MB)"} {a=$NF;getline;b=$NF;getline;c=$NF;print a,b*c}'
Regards,
Ninad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2006 12:32 AM
05-10-2006 12:32 AM
Re: script to find the unused disk
You can use SAM to locate disks which are not currently bound into a volume group (disks/filesystems -> volume groups -> Action tab -> create -> make up a temporary name -> select disks.
SAM will search through all the volume groups, then report on the disks that are not in any volume groups.
However, you need to know if special applications are using raw disks without the volume manager. Databases such as Informix and Sybase commonly use raw disks although the majority use the volume manager (like LVM) to partition the actual space. But only the applicaiton knows about these disks.
Still another solution is to download the Xvg utility (requires an Xwindow display) to map all the disks and volumes). Unused disks, lvols and space are glagged graphically.
So a scripted approach is somewhat difficult because there is no way to identify truly unused disks and raw disks actively used by applications. If you have inherited systems with very poor documentation, the are a couple of manual methods you can use. The first is to download/install lsof and run it on each of the disk device files. If the device file is open, it is currently in use. Of course, an application may only intermittently use the file. The other method is brute force: rename the raw disk device file and see if anything complains after after a couple of days...
Bill Hassell, sysadmin
SAM will search through all the volume groups, then report on the disks that are not in any volume groups.
However, you need to know if special applications are using raw disks without the volume manager. Databases such as Informix and Sybase commonly use raw disks although the majority use the volume manager (like LVM) to partition the actual space. But only the applicaiton knows about these disks.
Still another solution is to download the Xvg utility (requires an Xwindow display) to map all the disks and volumes). Unused disks, lvols and space are glagged graphically.
So a scripted approach is somewhat difficult because there is no way to identify truly unused disks and raw disks actively used by applications. If you have inherited systems with very poor documentation, the are a couple of manual methods you can use. The first is to download/install lsof and run it on each of the disk device files. If the device file is open, it is currently in use. Of course, an application may only intermittently use the file. The other method is brute force: rename the raw disk device file and see if anything complains after after a couple of days...
Bill Hassell, sysadmin
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP