Hello, this vzdump patch (against the 1.02 version which happened to be on my
centos box) attempts to detect when an lvm snapshot is being made of an XFS
filesystem and add the necessary mount options to have this actually succeed.
My perl coding skills are very rusty so please feel free to make fun of me :)
At a glance, the patch would probably work if it was folded into the new 1.1
version by hand, but I haven't tried this.
--- vzdump.orig 2009-05-28 03:31:45.000000000 -0700
+++ vzdump 2009-05-28 04:48:09.000000000 -0700
@@ -315,6 +315,28 @@
my $devmapper;
+sub is_xfs_mount {
+ my $mp = shift;
+
+ open (TMP, "</proc/mounts");
+ while (<TMP>) {
+ my $line = $_;
+ chomp($line);
+ my @lineitems = split (/\s+/, $line);
+ if ($lineitems[1] eq $mp) {
+ if ($lineitems[2] eq "xfs") {
+ close (TMP);
+ return 1;
+ } else {
+ close (TMP);
+ return 0;
+ }
+ }
+ }
+ close (TMP);
+ return 0;
+}
+
sub get_device {
my $dir = shift;
@@ -647,12 +669,13 @@
open (LOG, ">$logfile");
- my ($lvmpath, $lvmvg, $lvmlv);
+ my ($lvmpath, $lvmvg, $lvmlv, $lv_is_xfs);
if ($opt_snap) {
my ($dev, $mp, $vg, $lv) = get_device ($dir);
$lvmpath = $mp;
$lvmvg = $vg;
$lvmlv = $lv;
+ $lv_is_xfs = is_xfs_mount($lvmpath);
}
my $snapdev;
@@ -686,7 +709,12 @@
debugmsg ('info', "mounting lvm snapshot", \*LOG);
- run_command (\*LOG, "mount $snapdev /vzsnap");
+ my $mountopts = "";
+ if ($lv_is_xfs) {
+ $mountopts = "-o nouuid";
+ }
+
+ run_command (\*LOG, "mount $snapdev /vzsnap $mountopts");
$dir =~ s|/?$lvmpath/?|/vzsnap/|;
<---eof (actually one CR less)
-gmt
_______________________________________________
Users mailing list
[email protected]
https://openvz.org/mailman/listinfo/users