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
F82730690: D32856.diff
Thu, May 2, 2:00 AM
Unknown Object (File)
Wed, May 1, 2:26 PM
Unknown Object (File)
Sun, Apr 28, 7:49 PM
Unknown Object (File)
Sun, Apr 28, 6:00 PM
Unknown Object (File)
Sun, Apr 28, 6:00 PM
Unknown Object (File)
Sun, Apr 28, 4:04 PM
Unknown Object (File)
Mon, Apr 22, 9:32 PM
Unknown Object (File)
Mon, Apr 22, 9:32 PM

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