Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Nov 2021 00:32:35 GMT
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: cf09094e3983 - stable/13 - growfs: do not error if filesystem is already requested size
Message-ID:  <202111220032.1AM0WZe9084660@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=cf09094e3983298ee8f69a0011012e55e71fde30

commit cf09094e3983298ee8f69a0011012e55e71fde30
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2021-11-15 20:37:34 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2021-11-22 00:30:18 +0000

    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)
---
 sbin/growfs/growfs.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sbin/growfs/growfs.c b/sbin/growfs/growfs.c
index 510192dada0b..1f1bcf82c965 100644
--- a/sbin/growfs/growfs.c
+++ b/sbin/growfs/growfs.c
@@ -1503,7 +1503,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);
 	}
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202111220032.1AM0WZe9084660>