diff --git a/src/partition/repart.c b/src/partition/repart.c index 1e7978e97b..de7de65d72 100644 --- a/src/partition/repart.c +++ b/src/partition/repart.c @@ -2281,8 +2281,8 @@ static int context_load_partition_table(Context *context) { return log_oom(); if (arg_sector_size > 0) { - r = fdisk_save_user_sector_size(c, /* phy= */ 0, arg_sector_size); fs_secsz = arg_sector_size; + r = fdisk_save_user_sector_size(c, /* phy= */ 0, arg_sector_size); } else { uint32_t ssz; struct stat st; @@ -6150,7 +6150,8 @@ static int context_minimize(Context *context) { /* Massage the size a bit because just going by actual data used in the sparse file isn't * fool-proof. */ - fsz = round_up_size(fsz + (fsz / 2), context->grain_size); + uint64_t heuristic = streq(p->format, "xfs") ? fsz : fsz / 2; + fsz = round_up_size(fsz + heuristic, context->grain_size); if (minimal_size_by_fs_name(p->format) != UINT64_MAX) fsz = MAX(minimal_size_by_fs_name(p->format), fsz); diff --git a/src/shared/mkfs-util.c b/src/shared/mkfs-util.c index 3111bc0acc..b936a4733f 100644 --- a/src/shared/mkfs-util.c +++ b/src/shared/mkfs-util.c @@ -432,14 +432,13 @@ int make_filesystem( if (quiet && strv_extend(&argv, "-q") < 0) return log_oom(); - if (sector_size > 0) - FOREACH_STRING(s, "MKE2FS_DEVICE_SECTSIZE", "MKE2FS_DEVICE_PHYS_SECTSIZE") { - if (strv_extend(&env, s) < 0) + if (sector_size > 0) { + if (strv_extend(&env, "MKE2FS_DEVICE_SECTSIZE") < 0) return log_oom(); - if (strv_extendf(&env, "%"PRIu64, sector_size) < 0) - return log_oom(); - } + if (strv_extendf(&env, "%"PRIu64, sector_size) < 0) + return log_oom(); + } } else if (streq(fstype, "btrfs")) { argv = strv_new(mkfs,