- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: calculating total and free disk space on a sys...
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
Discussions
Discussions
Discussions
Forums
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
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
тАО07-22-2009 08:24 AM
тАО07-22-2009 08:24 AM
Is there any script for calculating the total and free disk space left on a HP Unix system
Regards
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-22-2009 08:32 AM
тАО07-22-2009 08:32 AM
Re: calculating total and free disk space on a system
Define "free".
If you mean "free" spaces within mounted filesystems, use 'bdf'. If you mean free physical disk extents within LVM volume groups, start with 'vgdisplay'. If you mean "unused" physical disks, tell us how you know they are truly unused if they could be raw volumes.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-22-2009 08:47 AM
тАО07-22-2009 08:47 AM
Re: calculating total and free disk space on a system
I want to calculate the free space in the VGs.
When we give vgdisplay command we get alloc Pe and Free PE.
I want to calculate the sum of all free space left and total allocated space left in VG.
I am looking for a script to do so
Regards
Amit Manna
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-22-2009 09:03 AM
тАО07-22-2009 09:03 AM
Re: calculating total and free disk space on a system
What output you want exactly. Free disk space in a VG, you can find with vgdisplay command. In a disk, you can find with pvdisplay command. bdf tells you the free space in the FS.
Or, please elaborate your question on what else you need.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-22-2009 09:17 AM
тАО07-22-2009 09:17 AM
Re: calculating total and free disk space on a system
vgdisplay will tell this information only i.e.
Total PE - Total disk space alloted to that VG.
Alloc PE - Disk space allocated to LVs in that VG.
Free PE - Unused Disk space in that VG.
But you need to see the PE size of that VG, which helps you calculate the space in MB. To calculate the space, use the formula:-
Space(MB) = PE Size * No. of PEs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-22-2009 09:24 AM
тАО07-22-2009 09:24 AM
Re: calculating total and free disk space on a system
do
vgdisplay $a|grep "PE Size"|awk '{print $4}'|read b
vgdisplay $a|grep "Total PE"|awk '{print $3}'|read c
vgdisplay $a|grep "Free PE"|awk '{print $3}'|read d
echo "$a $(b*c) $(b*d)"
done
first column will be vg name second column will be total size of vg and third column will be free space in VG
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-22-2009 09:31 AM
тАО07-22-2009 09:31 AM
Re: calculating total and free disk space on a system
For Calculating Total Disk with & Free Disk Space with the VG.
Please follow the below step.
Run the command vgdiaply
#root # vgdisplay
--- Volume groups ---
VG Name /dev/vg00
VG Write Access read/write
VG Status available
Max LV 255
Cur LV 17
Open LV 17
Max PV 16
Cur PV 4
Act PV 4
Max PE per PV 4384
VGDA 8
PE Size (Mbytes) 4
Total PE 17394
Alloc PE 6019
Free PE 11375
Total PVG 2
Total Spare PVs 0
Total Spare PVs in use 0
Cur PV - 4 - Means 4 Disk are using with the VG00
Free PE - 11375 - Means Free space Avilable on the VG.
For Calcuting the Total Free Space in the VG
is.
PE Size * Free PE = Total Free Space
Example - 4*11375 = 45500 is the Free Space in the VG
Thanks
Vinod Kumar Yadav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-22-2009 09:40 AM
тАО07-22-2009 09:40 AM
Re: calculating total and free disk space on a system
vgdisplay|grep "VG Name"|awk '{print $3}|'|while read a
do
vgdisplay $a|grep "PE Size"|awk '{print $4}'|read b
vgdisplay $a|grep "Total PE"|awk '{print $3}'|read c
vgdisplay $a|grep "Free PE"|awk '{print $3}'|read d
echo "$a $((b*c)) $((b*d))"
done
first column will be vg name second column will be total size of vg and third column will be free space in VG
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-23-2009 03:47 AM
тАО07-23-2009 03:47 AM
Re: calculating total and free disk space on a system
Regards
Amit Manna
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-23-2009 06:36 AM
тАО07-23-2009 06:36 AM
Re: calculating total and free disk space on a system
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-23-2009 08:27 AM
тАО07-23-2009 08:27 AM
Solutionvgdisplay 2>/dev/null |grep "VG Name"|awk '{print $3}'|while read a
do
vgdisplay $a|grep "PE Size"|awk '{print $4}'|read b
vgdisplay $a|grep "Total PE"|awk '{print $3}'|read c
vgdisplay $a|grep "Free PE"|awk '{print $3}'|read d
echo "$a $((b*c)) $((b*d))"
done
it should work like a charm:
# vgdisplay 2>/dev/null |grep "VG Name"|awk '{print $3}'|while read a
> do
> vgdisplay $a|grep "PE Size"|awk '{print $4}'|read b
> vgdisplay $a|grep "Total PE"|awk '{print $3}'|read c
> vgdisplay $a|grep "Free PE"|awk '{print $3}'|read d
> echo "$a $((b*c)) $((b*d))"
> done
/dev/vg00 139968 63712
/dev/vghomeora 139968 103968
/dev/vgquorum1 14368 13856
/dev/vgignite 115072 30336
#
Unix operates with beer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-23-2009 08:29 AM
тАО07-23-2009 08:29 AM
Re: calculating total and free disk space on a system
(and i added the error redirection just to don't get confused because of disabled VGs)
Unix operates with beer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-23-2009 10:39 AM
тАО07-23-2009 10:39 AM
Re: calculating total and free disk space on a system
@Amit, Please find attached script, which will give total size of vg, Free size in VG
Regards
Sanjeev
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-24-2009 01:57 AM
тАО07-24-2009 01:57 AM
Re: calculating total and free disk space on a system
Can we get the sum of total space and free space in all VGs?
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-24-2009 03:11 AM
тАО07-24-2009 03:11 AM
Re: calculating total and free disk space on a system
Yes, With this Script you can have both
Regards
Sanjeev