Skip to content

Commit

Permalink
fix backups with EFI disks
Browse files Browse the repository at this point in the history
A minimum size in general makes sense, if a disk is too small
drbd/drbd-utils simply refuse to work on these. The limit was 5MB, but
with that we saw weird side effects: on LVM for example 5MB became 8MB
(2 * 4MB). So far so good. When one backups a VM with an EFI disk on
DRBD everything looks fine, but on restore:

- PVE tries to create a 540672 bytes EFI disk
- the actual disk became larger (8MB in the example)
- vma has code that tolerates 4MB size differences, otherwise it bails
  out that sizes do not match.
- with 8MB we were over that tolerance => use a smaller cap (i.e. 3MB)
  to be in that tolerance

3MB is big enough so that none of our tools (LINSTOR/DRBD/drbd-utils)
complains, but small enough so that things work on LVM and ZFS.

This also fixes backups that have been made with "too large" EFI disks,
The important part is on restore and there the fix described above
applies.
  • Loading branch information
rck committed Jun 29, 2024
1 parent a06070e commit 2dfcc49
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion LINSTORPlugin.pm
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,19 @@ sub clone_image {
sub alloc_image {
my ( $class, $storeid, $scfg, $vmid, $fmt, $name, $size ) = @_;

my $min_kib = 5*1024;
# a minimum size in general makes sense, if a disk is too small
# drbd/drbd-utils simply refuse to work on these. the limit was
# 5MB, but with that we saw weird side effects: on LVM for example
# 5MB became 8MB (2 * 4MB). So far so good. when one backups a VM
# with an EFI disk on DRBD everything looks fine, but on restore:
# - PVE tries to create a 540672 bytes EFI disk
# - the actual disk became larger (8MB in the example)
# - vma has code that tolerates 4MB size differences, otherwise
# it bails out that sizes do not match.
# - with 8MB we were over that tolerance => use a smaller cap
# (i.e. 3MB) to be in that tolerance

my $min_kib = 3*1024;
$size = $min_kib unless $size > $min_kib;

die "unsupported format '$fmt'" if $fmt ne 'raw';
Expand Down

0 comments on commit 2dfcc49

Please sign in to comment.