diff --git a/assemblers/io.weldr.qcow2 b/assemblers/io.weldr.qcow2 index 12f396d9..b055ae71 100755 --- a/assemblers/io.weldr.qcow2 +++ b/assemblers/io.weldr.qcow2 @@ -2,6 +2,7 @@ import contextlib import json +import math import os import shutil import subprocess @@ -54,7 +55,7 @@ def main(tree, input_dir, output_dir, options): mountpoint = f"{workdir}/mnt" # Create an empty image file of the right size - size = int(tree_size(tree) * 1.2) + size = int(math.ceil(tree_size(tree) * 1.2 / 512) * 512) subprocess.run(["truncate", "--size", str(size), image], check=True) # Set up the partition table of the image diff --git a/stages/io.weldr.grub2 b/stages/io.weldr.grub2 index fb626194..a03f31b9 100755 --- a/stages/io.weldr.grub2 +++ b/stages/io.weldr.grub2 @@ -2,6 +2,7 @@ import contextlib import json +import math import os import shutil import subprocess @@ -58,7 +59,7 @@ def main(tree, input_dir, options): mountpoint = f"{workdir}/mnt" # Create an empty image file of the right size - size = int(tree_size(tree) * 1.2) + size = int(math.ceil(tree_size(tree) * 1.2 / 512) * 512) subprocess.run(["truncate", "--size", str(size), image], check=True) # Set up the partition table of the image