Comments (5)
  • Add a Comment
  • Edit
  • More Actions v
  • Quarantine this Entry

1 brunotm commented Permalink

Nice script, but in machines with lots of disks, its faster if you search those disk vg's only: <div>&nbsp;</div> for disk in `lspv | grep -w $vg | awk '{print $1}'`; do

2 brian_s commented Permalink

brunotm, Good suggestion - I updated the post with this.

3 jeffschaller42 commented Permalink

Love the script; thanks for sharing, Brian!

 
Along the same lines as bruntom, I wondered about changing that "lspv" line to use "lsvg -p". It didn't make much of a difference in runtime on systems with a small-ish numbers of disks, but I wonder if it would help any for larger environments. The theoretical improvement would be on systems that run multipathing software, where you have a bunch of hdisks consolidated into virtual disks; lspv would grind through each hdisk while 'lsvg -p' only lists the disks for the VG.
 
This is the change I made (the 'tail' skips the lsvg header):
 
< for disk in `lspv | grep -w $vg | awk '{print $1}'`; do
---
> for disk in `lsvg -p $vg | tail +3 | awk '{print $1}'`; do
 
Just a thought!
 
-jeff

4 dxtans commented Permalink

Yup, like the script. Simple but effective.

5 brian_s commented Permalink

Thanks Jeff, another great suggestion. I have updated the post with this.