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)
Sat, Dec 14, 9:10 PM
Unknown Object (File)
Mon, Nov 25, 6:06 PM
Unknown Object (File)
Nov 22 2024, 9:41 AM
Unknown Object (File)
Nov 14 2024, 9:07 PM
Unknown Object (File)
Nov 13 2024, 6:08 PM
Unknown Object (File)
Nov 12 2024, 5:26 AM
Unknown Object (File)
Nov 12 2024, 3:59 AM
Unknown Object (File)
Oct 28 2024, 12:55 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

Lint
Lint Skipped
Unit
Tests Skipped

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