Page MenuHomeFreeBSD

growfs: do not error if filesystem is already requested size
ClosedPublic

Authored by emaste on Nov 5 2021, 7:56 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Oct 28, 12:55 PM
Unknown Object (File)
Wed, Oct 23, 3:01 AM
Unknown Object (File)
Wed, Oct 23, 3:00 AM
Unknown Object (File)
Wed, Oct 23, 3:00 AM
Unknown Object (File)
Wed, Oct 23, 2:38 AM
Unknown Object (File)
Oct 3 2024, 7:03 AM
Unknown Object (File)
Sep 19 2024, 1:50 PM
Unknown Object (File)
Sep 8 2024, 6:20 PM
Subscribers

Details

Summary

If I have a filesystem on a partition or disk that is already the same size as that partition or disk growfs reports an error:

# growfs -y /dev/md0
growfs: requested size 100MB is not larger than the current filesystem size 100MB

Of course I can embiggen the disk/partition and growfs:

# mdconfig -d -u 0
# truncate -s 110M disk-image
# mdconfig -a -f disk-image
# growfs -y /dev/md0
super-block backups (for fsck_ffs -b #) at:
 205248

and get an error on a subsequent attempt:

# growfs -y /dev/md0
growfs: requested size 110MB is not larger than the current filesystem size 110MB

For some cloud/virtualization use cases it would be convenient to grow the filesystem on boot any time the disk/partition happens to be larger.

This could be under an option, but I think it's unnecessary. This patch leaves a message in place for this case, but exits with status 0.

# growfs -y /dev/md0
growfs: requested size 110MB is equal to the current filesystem size 110MB
# echo $?
0
#

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

emaste requested review of this revision.Nov 5 2021, 7:56 PM
emaste created this revision.

It's the first time I see errx(0, ...);, and I find it somewhat confusing, compared to warnx(...); return (0);, but grepping the source it's used like that in other places, so I guess it's just me :-)

This revision is now accepted and ready to land.Nov 13 2021, 2:32 PM