diff options
Diffstat (limited to 'src/partition')
-rw-r--r-- | src/partition/repart.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/partition/repart.c b/src/partition/repart.c index e4ae8a2c89..71c6956956 100644 --- a/src/partition/repart.c +++ b/src/partition/repart.c @@ -3963,6 +3963,8 @@ static int partition_populate_directory(Partition *p, Hashmap *denylist, char ** assert(ret); + log_info("Populating %s filesystem.", p->format); + r = var_tmp_dir(&vt); if (r < 0) return log_error_errno(r, "Could not determine temporary directory: %m"); @@ -3983,6 +3985,8 @@ static int partition_populate_directory(Partition *p, Hashmap *denylist, char ** if (r < 0) return r; + log_info("Successfully populated %s filesystem.", p->format); + *ret = TAKE_PTR(root); return 0; } @@ -3993,7 +3997,7 @@ static int partition_populate_filesystem(Partition *p, const char *node, Hashmap assert(p); assert(node); - log_info("Populating %s filesystem with files.", p->format); + log_info("Populating %s filesystem.", p->format); /* We copy in a child process, since we have to mount the fs for that, and we don't want that fs to * appear in the host namespace. Hence we fork a child that has its own file system namespace and @@ -4030,7 +4034,7 @@ static int partition_populate_filesystem(Partition *p, const char *node, Hashmap _exit(EXIT_SUCCESS); } - log_info("Successfully populated %s filesystem with files.", p->format); + log_info("Successfully populated %s filesystem.", p->format); return 0; } @@ -5436,6 +5440,7 @@ static int context_minimize(Context *context) { _cleanup_(loop_device_unrefp) LoopDevice *d = NULL; _cleanup_strv_free_ char **extra_mkfs_options = NULL; _cleanup_close_ int fd = -EBADF; + _cleanup_free_ char *hint = NULL; sd_id128_t fs_uuid; uint64_t fsz; @@ -5456,6 +5461,11 @@ static int context_minimize(Context *context) { assert(!p->copy_blocks_path); + (void) partition_hint(p, context->node, &hint); + + log_info("Pre-populating %s filesystem of partition %s twice to calculate minimal partition size", + p->format, strna(hint)); + r = make_copy_files_denylist(context, p, &denylist); if (r < 0) return r; @@ -5513,6 +5523,14 @@ static int context_minimize(Context *context) { /* Read-only filesystems are minimal from the first try because they create and size the * loopback file for us. */ if (fstype_is_ro(p->format)) { + struct stat st; + + if (stat(temp, &st) < 0) + return log_error_errno(errno, "Failed to stat temporary file: %m"); + + log_info("Minimal partition size of %s filesystem of partition %s is %s", + p->format, strna(hint), FORMAT_BYTES(st.st_size)); + p->copy_blocks_path = TAKE_PTR(temp); p->copy_blocks_path_is_our_file = true; continue; @@ -5546,6 +5564,9 @@ static int context_minimize(Context *context) { if (minimal_size_by_fs_name(p->format) != UINT64_MAX) fsz = MAX(minimal_size_by_fs_name(p->format), fsz); + log_info("Minimal partition size of %s filesystem of partition %s is %s", + p->format, strna(hint), FORMAT_BYTES(fsz)); + d = loop_device_unref(d); /* Erase the previous filesystem first. */ |