From 24a565a59b6491610f1360ac31daef1d732ff5de Mon Sep 17 00:00:00 2001 From: Clayton Craft Date: Sun, 20 Jan 2019 15:40:50 -0800 Subject: [PATCH] pmb: increase inode count for rootfs and use a more accurate size (!1743) This drops the --apparent-size parameter when calculating the size required for rootfs, which seemed to return a size that was too small for some devices. This also includes specifying the number of inodes to support when formatting rootfs. Fixes #1717 --- pmb/helpers/other.py | 1 - pmb/install/format.py | 3 ++- test/test_folder_size.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pmb/helpers/other.py b/pmb/helpers/other.py index 5dca8638..31956f6b 100644 --- a/pmb/helpers/other.py +++ b/pmb/helpers/other.py @@ -34,7 +34,6 @@ def folder_size(args, path): :returns: folder size in bytes """ output = pmb.helpers.run.root(args, ["du", "--summarize", - "--apparent-size", "--block-size=1", path], output_return=True) ret = int(output.split("\t")[0]) diff --git a/pmb/install/format.py b/pmb/install/format.py index 0ecd56bb..c85a2050 100644 --- a/pmb/install/format.py +++ b/pmb/install/format.py @@ -69,7 +69,8 @@ def format_and_mount_pm_crypt(args): # When changing the options of mkfs.ext4, also change them in the # recovery zip code (see 'grep -r mkfs\.ext4')! pmb.chroot.root(args, ["mkfs.ext4", "-O", "^metadata_csum", "-F", - "-q", "-L", "pmOS_root", device]) + "-q", "-L", "pmOS_root", "-N", "100000", + device]) # Mount mountpoint = "/mnt/install" diff --git a/test/test_folder_size.py b/test/test_folder_size.py index c079c6c7..79b90f03 100644 --- a/test/test_folder_size.py +++ b/test/test_folder_size.py @@ -49,8 +49,8 @@ def test_get_folder_size(args, tmpdir): # Check if the size is correct. Unfortunately, the `du` call # in pmb.helpers.other.folder_size is not very accurate, so we - # allow 10kb of tolerance (good enough for our use case): #760 - tolerance = 10240 + # allow 30kb of tolerance (good enough for our use case): #760 #1717 + tolerance = 30 * 1024 size = 204800 * files result = pmb.helpers.other.folder_size(args, tmpdir) assert (result < size + tolerance and result > size - tolerance)