aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2021-11-15 20:37:34 +0000
committerEd Maste <emaste@FreeBSD.org>2021-11-22 00:33:15 +0000
commit11f45b8f800975e0484940430b988b2006caf1e4 (patch)
tree4f04ea09e273d50c006b62088ec459c4580c9d6f
parentad235cff36a132bb21a9cef78afcabb1a14140e7 (diff)
growfs: do not error if filesystem is already requested size
For some cloud/virtualization use cases it can be convenient to grow the filesystem on boot any time the disk/partition happens to be larger, but not fail if it remains the same size. Continue to emit a message if we have no action to take, but exit with status 0 if the size remains the same. Reviewed by: trasz MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32856 (cherry picked from commit 3f9acedb020b4bcac850eee8a60c75e0880d3e3f)
-rw-r--r--sbin/growfs/growfs.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sbin/growfs/growfs.c b/sbin/growfs/growfs.c
index d1e42ed7c3d0..c47352e64079 100644
--- a/sbin/growfs/growfs.c
+++ b/sbin/growfs/growfs.c
@@ -1485,7 +1485,10 @@ main(int argc, char **argv)
humanize_number(newsizebuf, sizeof(newsizebuf), size,
"B", HN_AUTOSCALE, HN_B | HN_NOSPACE | HN_DECIMAL);
- errx(1, "requested size %s is not larger than the current "
+ if (size == (uint64_t)(osblock.fs_size * osblock.fs_fsize))
+ errx(0, "requested size %s is equal to the current "
+ "filesystem size %s", newsizebuf, oldsizebuf);
+ errx(1, "requested size %s is smaller than the current "
"filesystem size %s", newsizebuf, oldsizebuf);
}