Re: git: 8664e266d6a4 - main - growfs(7): clarify assumptions and limitations

From: Eugene Grosbein <eugen_at_grosbein.net>
Date: Fri, 06 Jan 2023 05:04:38 UTC
06.01.2023 7:44, Mike Karels wrote:

> The branch main has been updated by karels:
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=8664e266d6a4573d1875ee8f4ce0cdb091171780
> 
> commit 8664e266d6a4573d1875ee8f4ce0cdb091171780
> Author:     Mike Karels <karels@FreeBSD.org>
> AuthorDate: 2023-01-05 13:15:21 +0000
> Commit:     Mike Karels <karels@FreeBSD.org>
> CommitDate: 2023-01-06 00:44:16 +0000
> 
>     growfs(7): clarify assumptions and limitations
>     
>     Document that the growfs(7) script works only if the root file system
>     is in the last partition and free space immediately follows it.
>     Don't imply that /usr can be a separate partition, as that would
>     likely mean that root is not last.
>     
>     Reported by:    marklmi at yahoo dot com

Meantime, growfs(8) binary command living in /sbin successfully growfs root file system
being NOT last, if there is following free space immediately after it.

I use that feature occasionally dealing with installworld problem for systems installed
long time ago (pre-date introduction of Clang in FreeBSD)
when distinct root and /usr partitions sized 512MB were more than enough.

For example:

swap partition (b) 8GB
root partition (a) 512MB
/usr partition (d) 512MB
others including /usr/local, /home etc...

For major source based upgrade 512MB is not enough to hold new /usr contents,
so I temporary destroy swap partition at the beginning and recreate it 1GB less to make hole
that is used to create alternative 1GB sized partition temporary mounted as /mnt/usr.
I dump|restore /usr to /mnt/usr, change /etc/fstab to mount new partition as /usr
and not mount old one at all, and reboot. After that:

swap partition (b) 7GB
/usr partition (g) 1GB
root partition (a) 512MB
former /usr partition (d) 512MB
others...

Then I destroy partition (d) making free space immediately following root partition
that is NOT last one. And growfs(8) works on mounted r/w root just fine.
That worked every time I tried.

I wonder why growfs(7) should have the limitation described in cited commit.