Skip to content

Commit 3cce468

Browse files
AquaBxqzed
authored andcommitted
fix the disk size
1 parent 7171850 commit 3cce468

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

lib/base/img.sh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,22 +58,21 @@ _img_build() {
5858
_msg2 "Laying out partitions..."
5959

6060
# compute EFS partition size in MiB
61-
efs_size=$(du -bc "${_DIR_DISK_EFI}" | grep total | cut -f1)
62-
efs_part_size=$(( (efs_size*105)/100/(1024*1024) + 1))
61+
efs_part_size=$(du -s --block-size=1M "${_DIR_DISK_EFI}" | cut -f1)
6362

6463
if [[ $efs_part_size -lt 48 ]]; then
6564
efs_part_size=48
6665
fi
6766

6867
# compute root partition size in MiB
69-
root_size=$(du -bc "${_DIR_DISK_ROOT}" | grep total | cut -f1)
70-
root_part_size=$(( (root_size*110)/100/(1024*1024) + 1))
68+
root_size=$(du -s --block-size=1M "${_DIR_DISK_ROOT}" | cut -f1)
69+
root_part_size=$(( root_size + 128 ))
7170

7271
# compute disk size and create base image
7372
_msg2 "Allocating disk image..."
7473
_IMG_DISK="${_DIR_BUILD}/disk.img"
7574

76-
disk_size=$(( efs_part_size + root_part_size + 5 ))
75+
disk_size=$(( efs_part_size + root_part_size + 8 ))
7776
dd if=/dev/zero of="${_IMG_DISK}" bs="${disk_size}" count=1048576 status=none
7877
sync
7978

0 commit comments

Comments
 (0)