- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Script - number and names of lvols
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
03-23-2007 02:36 AM
03-23-2007 02:36 AM
I nead to get information how many logical volumes are there in specific vg.
Til now i have this :]
strings /dev/vg00 >>myfile
group
lvol1
rlvol1
lvol2
rlvol2
lvol3
rlvol3
lvol4
rlvol4
lvol5
rlvol5
lvol6
rlvol6
lvol7
rlvol7
lvol8
rlvol8
Now I nead to remove, all rvols and group strings.
Then read every line and put strings into the variable.
What commands should I use ?
Cheers
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2007 02:42 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2007 02:44 AM
03-23-2007 02:44 AM
Re: Script - number and names of lvols
how about
vgdisplay -v /dev/vg00 | grep -e 'Cur LV' -e'LV Name'
Please also read:
http://forums1.itrc.hp.com/service/forums/helptips.do?#33 on how to reward any useful answers given to your questions.
So far you have not awarded any points !
- Tags:
- vgdisplay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2007 02:47 AM
03-23-2007 02:47 AM
Re: Script - number and names of lvols
Simply use the ls command:
ls /dev/vg00/l* and all you are left with is "lvol1", "lvol2", ...
If you need to then process the LVOL's one at a time:
ls /dev/vg00/l* | while read LVOL
do
echo "Lvol: ${LVOL}"
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2007 02:57 AM
03-23-2007 02:57 AM
Re: Script - number and names of lvols
# bdf | (echo "number of vg00 lvols...\c";grep -c vg00)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2007 03:00 AM
03-23-2007 03:00 AM
Re: Script - number and names of lvols
One way is:
# LV=`vgdisplay -v vg00|awk '{if (/LV Name/) {split($3,a,/\//);printf "%s ",a[4]}}'`
# echo ${LV}
Regards!
...JRF...
- Tags:
- awk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2007 03:02 AM
03-23-2007 03:02 AM
Re: Script - number and names of lvols
Your replay is great becase the outpoot look like:
lvol1
lvol2
...
But what in sytuation when one or mre logical volumes hae different then standard names, for example: test, mylvol or whatever?
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2007 03:07 AM
03-23-2007 03:07 AM
Re: Script - number and names of lvols
find /dev/vg00 -type b | while read LVOL
do
echo "Lvol: ${LVOL}"
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2007 03:09 AM
03-23-2007 03:09 AM
Re: Script - number and names of lvols
grep -E '^lvol|group|^rlvol'
and so on
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2007 03:15 AM
03-23-2007 03:15 AM
Re: Script - number and names of lvols
The solution I offered also works with non-standard logical volume names. Try it.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2007 03:49 AM
03-23-2007 03:49 AM
Re: Script - number and names of lvols
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2007 12:42 AM
03-24-2007 12:42 AM
Re: Script - number and names of lvols
A 'thank you' is great and much appreciated feedback.
ut please also consider: http://forums1.itrc.hp.com/service/forums/helptips.do?#28
Be assiging appropriate points future readers will know which replies to focus on.
Also, you may want to 'close' this topic after 'submit' for points.
Cheers,
Hein van den Heuvel
[0 points for this]