[pve-devel] [PATCH installer 1/2] align metadatasize to 4 MiB

Fiona Ebner f.ebner at proxmox.com
Thu Jun 22 16:18:33 CEST 2023


First step towards fixing an issue reported in the community forum [0]
where using 250.00 hdsize, 250 maxroot and 0 minfree would fail.

Turns out two extents would be missing because of lvcreate implicitly
rounding up, one of them for the metadata.

[0]: https://forum.proxmox.com/threads/129320/post-566375

Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
---
 Proxmox/Install.pm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Proxmox/Install.pm b/Proxmox/Install.pm
index 7970f83..c2c014d 100644
--- a/Proxmox/Install.pm
+++ b/Proxmox/Install.pm
@@ -469,9 +469,10 @@ sub create_lvm_volumes {
 	die "unable to create root volume\n";
 
     if ($datasize > 4 * 1024 * 1024) {
-	my $metadatasize = $datasize/100; # default 1% of data
+	my $metadatasize = int($datasize/100); # default 1% of data
 	$metadatasize = 1024*1024 if $metadatasize < 1024*1024; # but at least 1G
 	$metadatasize = 16*1024*1024 if $metadatasize > 16*1024*1024; # but at most 16G
+	$metadatasize &= ~0xFFF; # align down to 4 MB boundaries
 
 	# otherwise the metadata is taken out of $minfree
 	$datasize -= 2 * $metadatasize;
-- 
2.39.2






More information about the pve-devel mailing list