- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- scripting ?
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
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
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-05-2010 12:13 PM
05-05-2010 12:13 PM
I have the following:
bdf |awk '{print $1}’ (which will give me each filesystem)
but drawing a blank on how to pass this variable to the following command:
and fstyp -v VARIABLE | grep -i version > new.file (which i believe would give me the version for each filesystem listed and send the info to a file)
Any suggestions would be appreciated!
Thanks!
Solved! Go to Solution.
- Tags:
- bdf
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2010 01:13 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2010 01:17 PM
05-05-2010 01:17 PM
Re: scripting ?
for LV in $(bdf -l |awk '{print $1}' |grep -v Filesystem)
do
VERS=$(fstyp -v ${LV} |grep -i -e ^version -e ^hfs)
echo ${LV} - ${VERS}
done
This gets rid the heading in the bdf output and also takes into account any HFS file systems. It looks for "hfs" at the beginning of a line and echos that since HFS filesystems do not have a "version" line.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2010 02:03 PM
05-05-2010 02:03 PM
Re: scripting ?
You might do:
# cat queryfs
#!/usr/bin/sh
bdf | awk 'NR==1 {next};print $1,$NF}' | \
while read DEV MNT
do
printf "%s %s " ${DEV} ${MNT}
fstyp -v ${DEV} | \
awk 'NR==1 {KIND=$1};
/^version|^hfs/ {print %s %s\n",KIND,$0}'
done
exit
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2010 05:17 PM
05-05-2010 05:17 PM
Re: scripting ?
bdfmegs -v
To see all the other options, use -h or -?:
bdfmegs -h
Usage: bdfmegs [ -cghlNPpqstuVv ] [
where:
-c # = Sort on column #
-d = Toggle divisor (1000 or 1024, current=1000)
-g = show gigabytes, otherwise megabytes
-h = Usage (return code=0, Usage to stdout)
-l = local (no NFS)
-M
-N
Repeat -N or use commas: -N vg10,vg24
-p ## = highlight % -ge ##
-P ## = show only % -ge ##
-q = suppress header line and no char enhancements
-s = summarize total, used and available
-t
-u = usage (return code=0, Usage to stdout)
-v = verbose (type, version, largefiles)
(version info needs read permission for mountpoint)
-V
Repeat -V or use commas: -V vg00,vg01
File(s) or dirpath(s) may be specified to reduce the output of bdfmegs:
bdfmegs -vg /usr/contrib/bin /var/tmp
If bdfmegs is run as bdfgigs (ie, a link), then -g is default.
(bdfmegs ver 5.5_Dec2009)
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2010 05:13 AM
05-06-2010 05:13 AM
Re: scripting ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2010 11:44 AM
05-24-2010 11:44 AM
Re: scripting ?
For instance, this here's a few lines illustrating some of the outliers...
/dev/vgXX/lvolX - version: 3
/ddd/vgxxxxx/lvxname - version: 3
39452672 -
/dev/vgyyyyy/lvyname - version: 3
23412736 -
/dev/vgzzzzz/lvzname - version: 4
Any further suggestions what caused the issue and how I can resolve it?
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2010 12:03 PM
05-24-2010 12:03 PM
Re: scripting ?
I'm sorry, it appears that I dropped or otherwise mangled some of my original post. Try:
# cat queryfs
#!/usr/bin/sh
bdf | awk '{if (NF==1) {line=$0;getline;sub(" *"," ");
print line$1,$NF} else {print $1,$NF}}' | \
while read DEV MNT
do
printf "%s %s " ${DEV} ${MNT}
fstyp -v ${DEV} | awk 'NR==1 {KIND=$1};
/^version|^hfs/ {printf "%s %s\n",KIND,$0}'
done
exit
...
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2010 12:21 PM
05-24-2010 12:21 PM
Re: scripting ?
Are the original bdf lines split? This is an annoying feature of bdf which is why I wrote bdfmegs. To get a clean, 1-liner output from bdf, do this:
bdf -l | while read FS TOT USED AVAIL PERCENT MNT
do
if [ $FS != "Filesystem" ]
then
if [ "$TOT" = "" ]
then
read TOT USED AVAIL PERCENT MNT
fi
echo $FS $TOT $USED $AVAIL $PERCENT $MNT
fi
done
This will give you a clean list of mountpoints. But you can get exactly what you want with bdfmegs:
bdfmegs -vq | awk '{print $NF,"-", $(NF-2)}'
/ - 5
/stand - na
/var - 5
/usr - 5
/tmp - 5
/opt - 5
/home - 5
/crashFiles - 6
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2010 02:45 PM
05-24-2010 02:45 PM
Re: scripting ?
Oops, now I dropped the code that skips the header of 'bdf'. This fixes that and handles multi-line 'bdf' output:
# cat queryfs
#!/usr/bin/sh
bdf | awk 'NR==1 {next};{if (NF==1) {line=$0;getline;sub(" *"," ");
print line$1,$NF} else {print $1,$NF}}' | \
while read DEV MNT
do
printf "%s %s " ${DEV} ${MNT}
fstyp -v ${DEV} | awk 'NR==1 {KIND=$1};
/^version|^hfs/ {printf "%s %s\n",KIND,$0}'
done
exit
# ./queryfs
/dev/vg00/lvol3 / vxfs version: 6
/dev/vg00/lvol1 /stand vxfs version: 5
/dev/vg00/lvol8 /var vxfs version: 6
/dev/vg00/lvol7 /usr vxfs version: 6
/dev/vg00/lvol6 /tmp vxfs version: 6
/dev/vg01/lvol1 /sysdev vxfs version: 6
/dev/vg01/lvol2 /patches vxfs version: 6
/dev/vg00/lvol5 /opt vxfs version: 6
/dev/vg00/lvol4 /home vxfs version: 6
Regards!
...JRF...