Index: sys/geom/part/g_part.c =================================================================== --- sys/geom/part/g_part.c +++ sys/geom/part/g_part.c @@ -2175,6 +2175,8 @@ g_part_resize(struct g_consumer *cp) { struct g_part_table *table; + bool docommit; + int error; G_PART_TRACE((G_T_TOPOLOGY, "%s(%s)", __func__, cp->provider->name)); g_topology_assert(); @@ -2188,12 +2190,14 @@ return; table->gpt_opened = 1; } - if (G_PART_RESIZE(table, NULL, NULL) == 0) - printf("GEOM_PART: %s was automatically resized.\n" - " Use `gpart commit %s` to save changes or " - "`gpart undo %s` to revert them.\n", cp->geom->name, - cp->geom->name, cp->geom->name); - if (g_part_check_integrity(table, cp) != 0) { + + docommit = G_PART_RESIZE(table, NULL, NULL) == 0; + + if (g_part_check_integrity(table, cp) == 0) { + if (docommit && (error = g_part_commit(cp)) != 0) + printf("GEOM_PART: Failed to commit changes for %s: %d\n", + cp->geom->name, error); + } else { g_access(cp, -1, -1, -1); table->gpt_opened = 0; g_part_wither(table->gpt_gp, ENXIO);