|
|
|
@ -64,6 +64,8 @@ $opts{compress} = 'none'; |
|
|
|
|
$opts{lvcreate} = '/sbin/lvcreate -c 512'; |
|
|
|
|
# lvremove path |
|
|
|
|
$opts{lvremove} = '/sbin/lvremove'; |
|
|
|
|
# lvs path |
|
|
|
|
$opts{lvs} = '/sbin/lvs'; |
|
|
|
|
# Override path to the LVM backend |
|
|
|
|
# Usefull if you have a layer between the filesystem |
|
|
|
|
# and the LVM volume, like GlusterFS |
|
|
|
@ -333,8 +335,13 @@ sub prepare_backup{ |
|
|
|
|
# If the disk is a file |
|
|
|
|
elsif ($disk->{type} eq 'file'){ |
|
|
|
|
# Try to find the mount point, and the backing device |
|
|
|
|
my @df = `df -P $source`; |
|
|
|
|
my ($dev,undef,undef,undef,undef,$mount) = split /\s+/, $df[1]; |
|
|
|
|
my @df = `df -PT $source`; |
|
|
|
|
my ($dev,$type,undef,undef,undef,undef,$mount) = split /\s+/, $df[1]; |
|
|
|
|
# Ok, we now have the backing device which probably looks like /dev/mapper/vg-lv |
|
|
|
|
# We cannot pass this arg to lvcreate to take a snapshot, wee need to detect Volume Group |
|
|
|
|
# name and Logical Volume name |
|
|
|
|
my (undef,$lv,$vg) = split (/\s+/, `/sbin/lvs --noheadings -o lv_name,vg_name $dev </dev/null`); |
|
|
|
|
$dev = '/dev/'. $vg . '/' . $lv |
|
|
|
|
# The backing device can be detected, but can also be overwritten with --lvm=/dev/data/vm |
|
|
|
|
# This can be usefull for example when you use GlusterFS. Df will return something like |
|
|
|
|
# localhost:/vmstore as the device, but this GlusterFS volume might be backed by an LVM |
|
|
|
@ -361,7 +368,9 @@ sub prepare_backup{ |
|
|
|
|
my $snap = $lvm.$time; |
|
|
|
|
mkdir $mp || die "Couldn't create $mp: $!"; |
|
|
|
|
# -o nouuid is needed if XFS is used |
|
|
|
|
system("/bin/mount -o nouuid $snap $mp"); |
|
|
|
|
my $option = ($type eq 'xfs') ? '-o nouuid': ''; |
|
|
|
|
print "Mounting $snap on $mp\n (as an $type filesystem)\n" if ($opts{debug}); |
|
|
|
|
system("/bin/mount $option $snap $mp"); |
|
|
|
|
open MOUNT, ">$backupdir.meta/mount"; |
|
|
|
|
print MOUNT $lvm; |
|
|
|
|
close MOUNT; |
|
|
|
|