[pve-devel] Update LXC vzdump to support BTRFS

Thomas Freudenberg th.freudenberg at 4commerce.de
Thu Nov 2 18:33:18 CET 2023


Hi everyone,

in case that we need support for BTRFS SNAPSHOT Backups, I have patched the file:

/usr/share/perl5/PVE/LXC.pm

and added support to mount BTRFS SNAPSHOT SUBVOL.

If interested let me know if I should send in a patch.

Cheers
Tom


1795a1796,1813
>                   } elsif ($scfg->{type} eq 'btrfs') {
>                       # extract subvol path for snapshot from storage
>                       my $snap_subvol_path = $path =~s/$scfg->{path}\///r;
>
>                       # parse result from btrfs command for device uuid
>                       my $device_uuid;
>
>                       my $parser = sub {
>                           my $line = shift;
>                           if ($line =~ m/^.*\s+uuid:\s+([0-9a-f-]+)(\s+.*)?$/) {
>                               $device_uuid = $1;
>                           }
>                       };
>
>                       # get uuid for block device from btrfs volume
>                       PVE::Tools::run_command(['btrfs', 'filesystem', 'show', '-m', '/vol/pve'], outfunc => $parser, timeout => 10);
>
>                       PVE::Tools::run_command(['mount', '-o', 'ro', @extra_opts, '-t', 'btrfs', '-o', "subvol=$snap_subvol_path", "UUID=$device_uuid", $mount_path]);



More information about the pve-devel mailing list