SI/lvm.pm
changeset 6 df6ca24871d4
parent 3 1b975c58c5bf
child 7 03ca6d811a17
equal deleted inserted replaced
3:1b975c58c5bf 6:df6ca24871d4
     2 
     2 
     3 use strict;
     3 use strict;
     4 use warnings;
     4 use warnings;
     5 use SI::tools;
     5 use SI::tools;
     6 
     6 
     7 sub vg_info($\%) {
     7 sub vgcfgbackup($\%) {
     8     my ($file, $part) = @_;
     8     my ($file, $part) = @_;
     9     foreach (map { (split /:/)[0] }
     9     foreach (map { (split /:/)[0] }
    10         map { /^\s*(.*)/; } `vgs --noheadings --separator :`)
    10         map { /^\s*(.*)/; } `vgs --noheadings --separator :`)
    11     {
    11     {
    12         my $file = sprintf $file, $_;
    12         my $file = sprintf $file, $_;
    13         run("vgcfgbackup -f $file >/dev/null");
    13         run("vgcfgbackup -f $file >/dev/null");
    14     }
    14     }
    15 }
    15 }
    16 
    16 
    17 sub lv_info($\%) {
       
    18     my ($file, $part) = @_;
       
    19 
       
    20     foreach my $p (keys %$part) {
       
    21         `pvs -o +uuid --nameprefix --noheadings $p` =~ /\bLVM2_PV_UUID='(.*?)'/
       
    22           or next;
       
    23 
       
    24         $part->{$p}{type} = "pv";
       
    25         $part->{$p}{uuid} = $1;
       
    26 
       
    27     }
       
    28 
       
    29 }
       
    30 
       
    31 1;
    17 1;
    32 # vim:sts=4 sw=4 aw ai si:
    18 # vim:sts=4 sw=4 aw ai si: