[pve-devel] [PATCH pve-container 3/3] vzdump:lxc: sync and skip journal in snapshot mode
Wolfgang Bumiller
w.bumiller at proxmox.com
Fri Sep 25 12:18:03 CEST 2015
When using block device based snapshots we cannot mount the
filesystem as it's not clean, and we also can't replay the
journal without write access (as even `-o ro` writes to
devices when replaying a journal (see the linux docs under
Documentation/filesystems/ext4.txt section 3 option 'ro')).
So now we perform a 'sync' after 'lxc-freeze' and before
creating the snapshot, then mount with '-o noload' which
skips the journal entirely and allows us to mount the
filesystem.
---
src/PVE/LXC.pm | 7 +++----
src/PVE/VZDump/LXC.pm | 2 +-
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index c198eaf..9a8110e 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -1719,20 +1719,19 @@ sub snapshot_create {
my $conf = load_config($vmid);
- my $cmd = "/usr/bin/lxc-freeze -n $vmid";
my $running = check_running($vmid);
eval {
if ($running) {
- PVE::Tools::run_command($cmd);
+ PVE::Tools::run_command(['/usr/bin/lxc-freeze', '-n', $vmid]);
+ PVE::Tools::run_command(['/bin/sync']);
};
my $storecfg = PVE::Storage::config();
my $rootinfo = parse_ct_mountpoint($conf->{rootfs});
my $volid = $rootinfo->{volume};
- $cmd = "/usr/bin/lxc-unfreeze -n $vmid";
if ($running) {
- PVE::Tools::run_command($cmd);
+ PVE::Tools::run_command(['/usr/bin/lxc-unfreeze', '-n', $vmid]);
};
PVE::Storage::volume_snapshot($storecfg, $volid, $snapname);
diff --git a/src/PVE/VZDump/LXC.pm b/src/PVE/VZDump/LXC.pm
index a7fafe9..fa1e4ec 100644
--- a/src/PVE/VZDump/LXC.pm
+++ b/src/PVE/VZDump/LXC.pm
@@ -195,7 +195,7 @@ sub snapshot {
PVE::Storage::activate_volumes($storage_cfg, $volid_list, 'vzdump');
foreach my $disk (@$disks) {
$disk->{dir} = "${rootdir}$disk->{mp}";
- PVE::LXC::mountpoint_mount($disk, $rootdir, $storage_cfg, 'vzdump');
+ PVE::LXC::mountpoint_mount($disk, $rootdir, $storage_cfg, 'vzdump', ['-o', 'noload']);
}
$task->{snapdir} = $rootdir;
--
2.1.4
More information about the pve-devel
mailing list