This file is indexed.

/usr/share/perl5/Linux/LVM.pm is in liblinux-lvm-perl 0.15.01-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
package Linux::LVM;

use 5.006;
use strict;
use warnings;

require Exporter;
use AutoLoader qw(AUTOLOAD);

our @ISA = qw(Exporter);

# Items to export into callers namespace by default. Note: do not export
# names by default without a very good reason. Use EXPORT_OK instead.
# Do not simply export all your public functions/methods/constants.

# This allows declaration	use Linux::LVM ':all';
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
# will save memory.
our %EXPORT_TAGS = ( 'all' => [ qw( get_volume_group_list
                                    get_volume_group_information
                                    get_logical_volume_information
                                    get_physical_volume_information
                                    get_vg_information
                                    get_pv_info
                                    get_lv_info
) ] );

our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );

our @EXPORT = qw( get_volume_group_list
                  get_volume_group_information
                  get_logical_volume_information
                  get_physical_volume_information
                  get_vg_information
                  get_pv_info
                  get_lv_info
);

our $VERSION = '0.15.01';


# Preloaded methods go here.

# Autoload methods go after =cut, and are processed by the autosplit program.

#-----------------------------------------------------------------------#
# Subroutine: get_volume_group_list                                     #
#-----------------------------------------------------------------------#
# Description: This function will return a sorted list of all of the    #
#              active volume groups on the system.                      #
#-----------------------------------------------------------------------#
# Parameters: None                                                      #
#-----------------------------------------------------------------------#
# Return Values: On success, a array with the volume group names.       #
#-----------------------------------------------------------------------#
sub get_volume_group_list() {
    my %vg = get_vg_information();
    return (sort keys(%vg));
} # End of the get_volume_group_list routine.


#-----------------------------------------------------------------------#
# Subroutine: get_volume_group_information                              #
#-----------------------------------------------------------------------#
# Description: This function will return a hash containing all of the   #
#              data about the specified volume group.                   #
#-----------------------------------------------------------------------#
# Parameters: A string containing a volume group name.                  #
#-----------------------------------------------------------------------#
# Return Values: On success, a hast with the volume group data.         #
#-----------------------------------------------------------------------#
sub get_volume_group_information($) {
    my $volume_group = $_[0];
    my %vg_info;
    my %vg = get_vg_information();

    foreach(sort keys %{$vg{$volume_group}}) {
        if   ( $_ eq "pvols" ) { next; }
        elsif( $_ eq "lvols" ) { next; }
        else                   { 
            $vg_info{$_} = $vg{$volume_group}->{$_}; 
        }
    }
    return %vg_info;
} # End of the get_volume_group_information routine.


#-----------------------------------------------------------------------#
# Subroutine: get_volume_group_information                              #
#-----------------------------------------------------------------------#
# Description: This function will return a hash containing all of the   #
#              data about the specified volume group.                   #
#-----------------------------------------------------------------------#
# Parameters: A string containing a volume group name.                  #
#-----------------------------------------------------------------------#
# Return Values: On success, a hast with the volume group data.         #
#-----------------------------------------------------------------------#
sub get_logical_volume_information($) {
    my $volume_group = $_[0];
    my %lv_info;
    my $lvname;
    my %vg = get_vg_information();

    foreach $lvname (sort keys %{$vg{$volume_group}->{lvols}}) {
        foreach(sort keys %{$vg{$volume_group}->{lvols}->{$lvname}}) {
            $lv_info{$lvname}->{$_} = $vg{$volume_group}->{lvols}->{$lvname}->{$_};
        }
    }
    return %lv_info;
} # End of the get_logical_volume_information routine.


#-----------------------------------------------------------------------#
# Subroutine: get_volume_group_information                              #
#-----------------------------------------------------------------------#
# Description: This function will return a hash containing all of the   #
#              data about the specified volume group.                   #
#-----------------------------------------------------------------------#
# Parameters: A string containing a volume group name.                  #
#-----------------------------------------------------------------------#
# Return Values: On success, a hast with the volume group data.         #
#-----------------------------------------------------------------------#
sub get_physical_volume_information($) {
    my $volume_group = $_[0];
    my %pv_info;
    my $pvname;
    my %vg = get_vg_information();

    foreach $pvname (sort keys %{$vg{$volume_group}->{pvols}}) {
        foreach(sort keys %{$vg{$volume_group}->{pvols}->{$pvname}}) {
            $pv_info{$pvname}->{$_} = $vg{$volume_group}->{pvols}->{$pvname}->{$_};
        }
    }
    return %pv_info;
} # End of the get_physical_volume_information routine.


#-----------------------------------------------------------------------#
# Subroutine: get_vg_information                                        #
#-----------------------------------------------------------------------#
# Description: This function will return a hash containing all of the   #
#              volume group information for the system.                 #
#-----------------------------------------------------------------------#
# Parameters: None                                                      #
#-----------------------------------------------------------------------#
# Return Values: On success, a hash with all of the vg information.     #
#-----------------------------------------------------------------------#
sub get_vg_information() {
    my %vghash;
    my $vgn;
    my $lvn;
    my $pvn;

    my @vginfo;

    if ( -e "/usr/sbin/vgdisplay" ) {
        @vginfo = `/usr/sbin/vgdisplay -v`;
    } else {
        if( ! -e "/sbin/vgdisplay" ) { die("LVM utilities not installed in /sbin or /usr/sbin"); }
        @vginfo = `/sbin/vgdisplay -v`;
    }

    VGINF: foreach(@vginfo) {
        chomp;
        s/^\s+//g;
        s/\s+$//g;
        next VGINF if m/^$/;

        # Parse the volume group name.
        if( m/VG Name\s+(\S+)/ ) { 
            $vgn = $1; $vghash{$vgn}->{vgname} = $1; 
            next VGINF; }

        # Parse the volume group access.
        elsif( m/VG Access\s+(\S+)/ ) { 
            $vghash{$vgn}->{access} = $1; 
            next VGINF; }

        # Parse the volume group status.
        elsif( m/VG Status\s+(.+)/ ) { 
            $vghash{$vgn}->{status} = $1; 
            next VGINF; }

        # Parse the volume group number.
        elsif( m/VG #\s+(\S+)/ ) { 
            $vghash{$vgn}->{vg_number} = $1; 
            next VGINF; }

        # Parse the maximum logical volume size and size unit for the volume group.
        elsif( m/MAX LV Size\s+(\S+) (\S+)/ ) {
            $vghash{$vgn}->{max_lv_size} = $1;
            $vghash{$vgn}->{max_lv_size_unit} = $2; 
            next VGINF; }

        # Parse the maximum number of logical volumes for the volume group.
        elsif( m/MAX LV\s+(\S+)/ ) { 
            $vghash{$vgn}->{max_lv} = $1; 
            next VGINF; }

        # Parse the current number of logical volumes for the volume group.
        elsif( m/Cur LV\s+(\S+)/ ) { 
            $vghash{$vgn}->{cur_lv} = $1; 
            next VGINF; }

        # Parse the number of open logical volumes for the volume group.
        elsif( m/Open LV\s+(\S+)/ )   { 
            $vghash{$vgn}->{open_lv} = $1; 
            next VGINF; }

        # Parse the number of physical volumes accessible to the volume group.
        elsif( m/Max PV\s+(\S+)/ ) { 
            $vghash{$vgn}->{max_pv} = $1; 
            next VGINF; }

        # Parse the current number of physical volumes in the volume group.
        elsif( m/Cur PV\s+(\S+)/ ) { 
            $vghash{$vgn}->{cur_pv} = $1; 
            next VGINF; }

        # Parse the number of active physical volumes in the volume group.
        elsif( m/Act PV\s+(\S+)/ ) { 
            $vghash{$vgn}->{act_pv} = $1; 
            next VGINF; }

        # Parse the size of the volume group.
        elsif( m/VG Size\s+(\S+) (\S+)/ ) {
            $vghash{$vgn}->{vg_size} = $1;
            $vghash{$vgn}->{vg_size_unit} = $2; 
            next VGINF; }

        # Parse the physical extent size and unit for one extent of volume group.
        elsif( m/PE Size\s+(\S+) (\S+)/ ) {
            $vghash{$vgn}->{pe_size} = $1;
            $vghash{$vgn}->{pe_size_unit} = $2; 
            next VGINF; }

        # Parse the total number and number of free physical extents from the physical disk.
        elsif( m/Total PE \/ Free PE\s+(\S+) \/ (\S+)/m ) {
            $vghash{$vgn}->{pvols}->{$pvn}->{total_pe} = $1;
            $vghash{$vgn}->{pvols}->{$pvn}->{free_pe} = $2;
            next VGINF; }

        # Parse the total number of physical extents from the volume group.
        elsif( m/Total PE\s+(\S+)/ ) { 
            $vghash{$vgn}->{total_pe} = $1; 
            next VGINF; }

        # Parse the number of allocated physical extents from the volume group.
        elsif( m/Alloc PE \/ Size\s+(\S+) \/ (\S+)(?:\s+(\S+))?/ ) {
            $vghash{$vgn}->{alloc_pe} = $1;
            $vghash{$vgn}->{alloc_pe_size} = $2;
            $vghash{$vgn}->{alloc_pe_size_unit} = $3 || "B";
            next VGINF; }

        # Parse the volume group name.
        elsif( m/Free  PE \/ Size\s+(\S+) \/ (\S+) (\S+)/ ) {
            $vghash{$vgn}->{free_pe} = $1;
            $vghash{$vgn}->{free_pe_size} = $2;
            $vghash{$vgn}->{free_pe_size_unit} = $3; 
            next VGINF; }

        # Parse the volume group uuid.
        elsif( m/VG UUID\s+(\S+)/ ) { 
            $vghash{$vgn}->{uuid} = $1; 
            next VGINF; }

        # Parse the logical volume name.
        elsif( m/LV Name\s+(\S+)/ ) { 
            $lvn = $1; 
            $vghash{$vgn}->{lvols}->{$lvn}->{name} = $1; 
            next VGINF; }

        # Parse the logical volume UUID.
        elsif( m/LV UUID\s+(\S+)/ ) { 
            $vghash{$vgn}->{lvols}->{$lvn}->{uuid} = $1; 
            next VGINF; }

        # Parse the logical volume UUID.
        elsif( m/Segments\s+(\S+)/ ) { 
            $vghash{$vgn}->{lvols}->{$lvn}->{segments} = $1; 
            next VGINF; }

        # Parse the logical volume size and unit.
        elsif( m/LV Size\s+(\S+) (\S+)/ ) {
            $vghash{$vgn}->{lvols}->{$lvn}->{lv_size} = $1;
            $vghash{$vgn}->{lvols}->{$lvn}->{lv_size_unit} = $2; 
            next VGINF; }

        # Parse the logical volume write access.
        elsif( m/LV Write Access\s+(\S+)/ ) { 
            $vghash{$vgn}->{lvols}->{$lvn}->{write_access} = $1; 
            next VGINF; }

        # Parse the logical volume status.
        elsif( m/LV Status\s+(.+)/ ) { 
            $vghash{$vgn}->{lvols}->{$lvn}->{status} = $1; 
            next VGINF; }

        # Parse the number of logical extents in the logical volume.
        elsif( m/Current LE\s+(\S+)/ ) { 
            $vghash{$vgn}->{lvols}->{$lvn}->{cur_le} = $1; 
            next VGINF; }

        # Parse the number of allocated logical extents in the logical volume.
        elsif( m/Allocated LE\s+(\S+)/ ) { 
            $vghash{$vgn}->{lvols}->{$lvn}->{alloc_le} = $1; 
            next VGINF; }

        # Parse the allocation type for the logical volume.
        elsif( m/Allocation\s+(.+)/ ) { 
            $vghash{$vgn}->{lvols}->{$lvn}->{allocation} = $1; 
            next VGINF; }

        # Parse the volume number.
        elsif( m/LV #\s+(\S+)/ ) { 
            $vghash{$vgn}->{lvols}->{$lvn}->{lv_number} = $1; 
            next VGINF; }

        # Parse the number of times the logical volume is open.
        elsif( m/# open\s+(\S+)/ ) { 
            $vghash{$vgn}->{lvols}->{$lvn}->{open_lv} = $1; 
            next VGINF; }

        # Parse the block device of the logical volume.
        elsif( m/Block device\s+(\S+)/ ) { 
            $vghash{$vgn}->{lvols}->{$lvn}->{device} = $1; 
            next VGINF; }

        # Parse the value for the read ahead sectors of the logical volume.
        elsif( m/Read ahead sectors\s+(\S+)/ ) { 
            $vghash{$vgn}->{lvols}->{$lvn}->{read_ahead} = $1; 
            next VGINF; }


        elsif( m/Allocated to snapshot\s+(\S+)%/ ) {
            $vghash{$vgn}->{lvols}->{$lvn}->{'allocated_to_snapshot'} = $1;
            next VGINF; }

        elsif( m/COW-table size\s+([0-9\.]+)\s+(\S+)/ ) {
            $vghash{$vgn}->{lvols}->{$lvn}->{'cow_table_size'} = $1;
            $vghash{$vgn}->{lvols}->{$lvn}->{'cow_table_unit'} = $2;
            next VGINF; }

        elsif( m/Mirrored volumes\s+(.+)/ ) {
                $vghash{$vgn}->{lvols}->{$lvn}->{'mirrored_volumes'} = $1;
                next VGINF; }

        # Parse the physical disk name.
        elsif( m/PV Name\s+(\S+)/ ) {
            $pvn = $1;
            $vghash{$vgn}->{pvols}->{$pvn}->{device} = $1;
            next VGINF; }

        # Parse the status of the physical disk.
        elsif( m/PV Status\s+(.+)/ ) { 
            $vghash{$vgn}->{pvols}->{$pvn}->{status} = $1; 
            next VGINF; }

        # Parse the status of the physical disk.
        elsif( m/PV UUID\s+(.+)/ ) { 
            $vghash{$vgn}->{pvols}->{$pvn}->{uuid} = $1; 
            next VGINF; }

    }
    return %vghash;
} # End of the get_vg_information routine.


#-----------------------------------------------------------------------#
# Subroutine: get_pv_info                                               #
#-----------------------------------------------------------------------#
# Description: This function will return a hash containing all of the   #
#              information about the specified physical volume.         #
#-----------------------------------------------------------------------#
# Parameters: None                                                      #
#-----------------------------------------------------------------------#
# Return Values: On success, a hash with all of the pv information.     #
#-----------------------------------------------------------------------#
sub get_pv_info($) {
    my $pvname = $_[0];
    my %pvhash;
    my @pvinfo;

    if( ! -e "$pvname" ) { die("Physical Disk: $pvname does not exist."); }

    if ( -e "/usr/sbin/pvdisplay" ) {
        @pvinfo = `/usr/sbin/pvdisplay $pvname`;
    } else {
        if( ! -e "/sbin/pvdisplay" ) { die("LVM utilities not installed in /sbin or /usr/sbin"); }
        @pvinfo = `/sbin/pvdisplay $pvname`;
    }


    PVINF: foreach(@pvinfo) {
        # Get the name of the physical volume.
        if( m/PV Name\s+(\S+)/ ) {
            $pvhash{pv_name} = $1;
            next PVINF; }

        # Get the name of the volume group the physical volume belongs to.
        if( m/VG Name\s+(\S+)/ ) {
            $pvhash{vg_name} = $1;
            next PVINF; }

        # Get the size information of the physical volume.
        if( m/PV Size\s+(\S+) (\S+)/ ) {
            $pvhash{size} = $1;
            $pvhash{size_unit} = $2;
            next PVINF; }

        # Get the physical volume number.
        if( m/PV\#\s+(\S+)/ ) {
            $pvhash{pv_number} = $1;
            next PVINF; }

        # Get the status of the physical volume.
        if( m/PV Status\s+(.+)/ ) {
            $pvhash{status} = $1;
            next PVINF; }

        # Get the allocation status of the physical volume.
        if( m/Allocatable\s+(.+)/ ) {
            $pvhash{allocatable} = $1;
            next PVINF; }

        # Get the number of logical volumes on the physical volume.
        if( m/Cur LV\s+(\S+)/ ) {
            $pvhash{num_lvols} = $1;
            next PVINF; }

        # Get the physical extent size and unit of the physical volume.
        if( m/PE Size \((\S+)\)\s+(\S+)/ ) {
            $pvhash{pe_size} = $2;
            $pvhash{pe_size_unit} = $1;
            next PVINF; }

        # Get the total numver of physical extents on the physical volume.
        if( m/Total PE\s+(\S+)/ ) {
            $pvhash{total_pe} = $1;
            next PVINF; }

        # Get the number of free extents on the physical volume.
        if( m/Free PE\s+(\S+)/ ) {
            $pvhash{free_pe} = $1;
            next PVINF; }

        # Get the number of allocated physical extents on the physical volume.
        if( m/Allocated PE\s+(\S+)/ ) {
            $pvhash{alloc_pe} = $1;
            next PVINF; }

        # Get the UUID of the physical volume.
        if( m/PV UUID\s+(\S+)/ ) {
            $pvhash{uuid} = $1;
            next PVINF; }
    }
    return %pvhash;
} # End of the get_pv_info routine.


#-----------------------------------------------------------------------#
# Subroutine: get_lv_info                                               #
#-----------------------------------------------------------------------#
# Description: This function will return a hash containing all of the   #
#              information about the specified logical volume.          #
#-----------------------------------------------------------------------#
# Parameters: None                                                      #
#-----------------------------------------------------------------------#
# Return Values: On success, a hash with all of the lv information.     #
#-----------------------------------------------------------------------#
sub get_lv_info($) {
    my $lvname = $_[0];
    my %lvhash;
    my @lvinfo;

    if( ! -e "$lvname" ) { die("Logical Disk: $lvname does not exist."); }

    if ( -e "/usr/sbin/vgdisplay" ) {
        @lvinfo = `/usr/sbin/lvdisplay $lvname`;
    } else {
        if( ! -e "/sbin/vgdisplay" ) { die("LVM utilities not installed in /sbin or /usr/sbin"); }
        @lvinfo = `/sbin/lvdisplay $lvname`;
    }

    LVINF: foreach(@lvinfo) {

        # Get the logical volume name.
        if( m/LV Name\s+(\S+)/ ) {
            $lvhash{lv_name} = $1;
            next LVINF; }

        # Get the volume group name.
        if( m/VG Name\s+(\S+)/ ) {
            $lvhash{vg_name} = $1;
            next LVINF; }

        # Get the volume group name.
        if( m/LV UUID\s+(\S+)/ ) {
            $lvhash{uuid} = $1;
            next LVINF; }

        # Get the logical volume write status.
        if( m/LV Write Access\s+(.+)/ ) {
            $lvhash{access} = $1;
            next LVINF; }

        # Get the logical volume status.
        if( m/LV Status\s+(.+)/ ) {
            $lvhash{status} = $1;
            next LVINF; }

        # Get the logical volume number.
        if( m/LV \#\s+(\S+)/ ) {
            $lvhash{lv_number} = $1;
            next LVINF; }

        # Get the number of opens for the logical volume.
        if( m/\# open\s+(\S+)/ ) {
            $lvhash{lv_open} = $1;
            next LVINF; }

        # Get the logical volume size and size unit.
        if( m/LV Size\s+(\S+) (\S+)/ )  {
            $lvhash{size} = $1;
            $lvhash{size_unit} = $2;
            next LVINF; }

        # Get the number of extents assigned to the logical volume.
        if( m/Current LE\s+(\S+)/ ) {
            $lvhash{current_le} = $1;
            next LVINF; }

        # Get the number of extents allocated to the logical volume.
        if( m/Allocated LE\s+(\S+)/ )  {
            $lvhash{alloc_le} = $1;
            next LVINF; }

        # Get the extent allocation type of the logical volume.
        if( m/Allocation\s+(.+)/ ) {
            $lvhash{allocation} = $1;
            next LVINF; }

        # Get the number of read ahead sectors for the logical volume.
        if( m/Read ahead sectors\s+(\S+)/ ) {
            $lvhash{read_ahead} = $1;
            next LVINF; }

        # Get the block device of the logical volume.
        if( m/Block device\s+(\S+)/ ) {
            $lvhash{block_device} = $1;
            next LVINF; }

        if( m/Allocated to snapshot\s+(\S+)%/ ) {
            $lvhash{allocated_to_snapshot} = $1;
            next LVINF; }

        elsif( m/COW-table size\s+([0-9\.]+)\s+(\S+)/ ) {
            $lvhash{'cow_table_size'} = $1;
            $lvhash{'cow_table_unit'} = $2;
            next LVINF; }
    }
    return %lvhash;
} # End of the get_lv_info routine.


1;
__END__
# Below is stub documentation for your module. You'd better edit it!

=head1 NAME

Linux::LVM - Perl extension for accessing Logical Volume Manager(LVM)
             data structures on Linux.

=head1 SYNOPSIS

  use Linux::LVM;
  

=head1 ABSTRACT

  The live data used in the examples is included in the DESCRIPTION area
  for your convenience and reference.
  
=head1 DESCRIPTION
  
  get_volume_group_list()	This routine will return an array that
				contains the names of the volume groups.

  @vgs = get_volume_group_list(); print "@vgs \n"; 
  Would yield the following: vg00
   
    
  get_volume_group_information($)	This routine will return all of
					the volume group information about
					the specified volume group.

  %vg = get_volume_group_information("vg00");
  foreach(sort keys %vg) {
     print "$_ = $vg{$_}\n";
  }
  Would yield the following:
     access = read/write
     act_pv = 2
     alloc_pe = 3840
     alloc_pe_size = 15
     alloc_pe_size_unit = GB
     cur_lv = 3
     cur_pv = 2
     free_pe = 864
     free_pe_size = 3.38
     free_pe_size_unit = GB
     max_lv = 256
     max_lv_size = 255.99
     max_lv_size_unit = GB
     max_pv = 256
     open_lv = 0
     pe_size = 4
     pe_size_unit = MB
     status = available/resizable
     total_pe = 4704
     uuid = BBq8si-NyRR-9ZNW-3J5e-DoRO-RBHK-ckrszi
     vg_number = 0
     vg_size = 18.38
     vg_size_unit = GB
     vgname = vg00
   
  
  get_logical_volume_information($)	This routine will return all of the
					logical volume information associated
					with the specified volume group.
 
  %lv = get_logical_volume_information("vg00");
  foreach $lvname (sort keys %lv) {
      foreach(sort keys %{$lv{$lvname}}) {
          print "$_ = $lv{$lvname}->{$_}\n"; 
      }
      print "\n"; 
  }
  Would yield the following results:
  alloc_le = 1024
  allocation = next free
  cur_le = 1024
  device = 58:0
  lv_number = 1
  lv_size = 4
  lv_size_unit = GB
  name = /dev/vg00/lvol1
  open_lv = 0
  read_ahead = 1024
  status = available
  write_access = read/write
  
  alloc_le = 1280
  allocation = next free
  cur_le = 1280
  device = 58:1
  lv_number = 2
  lv_size = 5
  lv_size_unit = GB
  name = /dev/vg00/lvol2
  open_lv = 0
  read_ahead = 1024
  status = available
  write_access = read/write
  
  alloc_le = 1536
  allocation = next free
  cur_le = 1536
  device = 58:2
  lv_number = 3
  lv_size = 6
  lv_size_unit = GB
  name = /dev/vg00/lvol3
  open_lv = 0
  read_ahead = 1024
  status = available
  write_access = read/write
   
   
  get_physical_volume_information($)	This routine will return all of the information
					information about the physical volumes assigned 
					to the specified volume group.
   
  %pv = get_physical_volume_information("vg00");
  foreach $pvname (sort keys %pv) {
      foreach(sort keys %{$pv{$pvname}}) {
          print "$_ = $pv{$pvname}->{$_}\n";
      }
      print "\n";
  }
  Would yield the following results:
  device = /dev/hda3
  free_pe = 0
  pv_number = 1
  status = available / allocatable
  total_pe = 2160
  
  device = /dev/hda4
  free_pe = 864
  pv_number = 2
  status = available / allocatable
  total_pe = 2544
              
              
  get_lv_info($)	This routine will return all of the information about the
			specified logical volume.  The information will be returned
			in a hash.
              
  get_lv_info
  %lv = get_lv_info("/dev/vg00/lvol1");
  foreach (sort keys %lv) {
      print "$_ = $lv{$_} \n";
  }
  Would yield the following results:
  access = read/write 
  alloc_le = 1024 
  allocation = next free 
  block_device = 58:0 
  current_le = 1024 
  lv_name = /dev/vg00/lvol1 
  lv_number = 1 
  lv_open = 0 
  read_ahead = 1024 
  size = 4 
  size_unit = GB 
  status = available 
  vg_name = vg00 
              
              
              
  get_pv_info($)	This routine will return all of the information about the
			specified physical volume.  The information will be returned
			in a hash.
              
  %pv = get_pv_info("/dev/hda3");
  foreach (sort keys %pv) {
      print "$_ = $pv{$_} \n";
  }
  Would yield the following results:
  alloc_pe = 2160 
  allocatable = yes (but full) 
  free_pe = 0 
  num_lvols = 2 
  pe_size = 4096 
  pe_size_unit = KByte 
  pv_name = /dev/hda3 
  pv_number = 1 
  sectors = 17703630 
  size = 8.44 
  size_info = NOT usable 4.19 MB [LVM: 136 KB] 
  size_unit = GB 
  status = available 
  total_pe = 2160 
  uuid = 2c5ADu-oEdt-ovCe-rqp0-MWpF-I5u1-8XigH4 
  vg_name = vg00 
              
                   
     
  Command Output Used In The Above Examples: /sbin/vgdisplay -v
  --- Volume group ---
  VG Name               vg00
  VG Access             read/write
  VG Status             available/resizable
  VG #                  0
  MAX LV                256
  Cur LV                3
  Open LV               0
  MAX LV Size           255.99 GB
  Max PV                256
  Cur PV                2
  Act PV                2
  VG Size               18.38 GB
  PE Size               4 MB
  Total PE              4704
  Alloc PE / Size       3840 / 15 GB
  Free  PE / Size       864 / 3.38 GB
  VG UUID               BBq8si-NyRR-9ZNW-3J5e-DoRO-RBHK-ckrszi
  
  --- Logical volume ---
  LV Name                /dev/vg00/lvol1
  VG Name                vg00
  LV Write Access        read/write
  LV Status              available
  LV #                   1
  # open                 0
  LV Size                4 GB
  Current LE             1024
  Allocated LE           1024
  Allocation             next free
  Read ahead sectors     1024
  Block device           58:0
  
  --- Logical volume ---
  LV Name                /dev/vg00/lvol2
  VG Name                vg00
  LV Write Access        read/write
  LV Status              available
  LV #                   2
  # open                 0
  LV Size                5 GB
  Current LE             1280
  Allocated LE           1280
  Allocation             next free
  Read ahead sectors     1024
  Block device           58:1
  
  --- Logical volume ---
  LV Name                /dev/vg00/lvol3
  VG Name                vg00
  LV Write Access        read/write
  LV Status              available
  LV #                   3
  # open                 0
  LV Size                6 GB
  Current LE             1536
  Allocated LE           1536
  Allocation             next free
  Read ahead sectors     1024
  Block device           58:2
  
  --- Physical volumes ---
  PV Name (#)           /dev/hda3 (1)
  PV Status             available / allocatable
  Total PE / Free PE    2160 / 0
  
  PV Name (#)           /dev/hda4 (2)
  PV Status             available / allocatable
  Total PE / Free PE    2544 / 864


=head1 SEE ALSO

L<vgdisplay>(1M)
L<lvdisplay>(1M)
L<pvdisplay>(1M)

=head1 AUTHOR

Chad Kerner, E<lt>chadkerner@yahoo.comE<gt>

=head1 COPYRIGHT AND LICENSE

Copyright 2003 by Chad Kerner

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself. 

=cut