[linux-lvm] The way i use to ensure the VG map (Need help)
Germain Maurice
gmaurice at linkfluence.net
Wed Jun 6 11:00:04 UTC 2012
Hello,
Still with my huge problems (regular fs corruption inside KVM guests). I use a shared LVM on a SAN storage, without CLVM :(.
I would like to be sure I don't have LVs overlaping each other.
I ran vgck SATA6To, that doesn't produce output, so I expect everything is good on disk.
So, i tried to do the same on device mapper with the following script :
#!/usr/bin/perl
while(<>) {
# SATA6To-vm--316--disk--3: 0 8388608 linear 152:16 31457664
my ( $vol, $vol_start, $vol_size, $alloc, $raid, $pos ) = split( /\s/, $_ );
if( $vol =~ /^sata6to-vm--(\d{3})--disk--(\d)/i ) {
my $vm = $1;
my $disk = $2;
if( defined $vms->{ $vm }->{ $disk } ) {
die "HUGE PROBLEM: VM $vm DISK $disk ALREADY EXISTS!!!\n";
}
my $start = $pos;
my $stop = $pos+$vol_size-1;
$vms->{ $vm }->{ $disk } = {
start => $start,
stop => $stop,
};
if( defined $map->{ $start } ) {
warn "VM $vm/$disk WANTS TO START ON " . Dump $map->{ $start };
}
$map->{ $start } = { "$vm/$disk" => 'start' };
if( defined $map->{ $stop } ) {
warn "VM $vm/$disk WANTS TO STOP ON " . Dump $map->{ $stop };
}
$map->{ $stop } = { "$vm/$disk" => 'stop' };
}
}
for my $pos ( sort{ $a <=> $b } keys %$map ) {
printf( "%010d\t%s\t%s\n", $pos, ( %{ $map->{ $pos } } ) );
}
It produces this kind of output :
0000000384 316/1 start
0020971903 316/1 stop
0020971904 316/2 start
0031457663 316/2 stop
We check that no LV would start before a previous LV stop. By the way I did on the whole cluster to ensure I get the same result on the nodes.
Is it a good way to check the consistancy between LVM metadata and DeviceMapper ?
Your help will be precious, I'm going mad.
More information about the linux-lvm
mailing list