Adding a swap partition to the March 5 snapshot image

Mark Millard marklmi at yahoo.com
Fri Mar 6 18:24:11 UTC 2020



On 2020-Mar-6, at 09:58, bob prohaska <fbsd at www.zefox.net> wrote:

> On Thu, Mar 05, 2020 at 09:26:42PM -0800, Mark Millard wrote:
>> 
>> On 2020-Mar-5, at 20:54, bob prohaska <fbsd at www.zefox.net> wrote:
>>> 
>>> I've been trying for a while to set up an armv7 RPI2 with a single
>>> root partition plus a swap partition at the end of mmcsd0. Letting
>>> firstboot invoke growfs seems not to help, since growfs leaves no
>>> space for swap.
>>> 
>>> Attempts using gpart in single-user give the appearance of 
>>> working, but on reboot the machine stops at the mountroot prompt.
>>> This method worked well in July of 2018. Seemingly, no more. 
>>> 
>>> Has something changed? 
>>> 
>>> Mounting the armv7 card on a second Freebsd box and making the changes 
>>> appears to work also, but on the initial boot (firstboot disabled) the 
>>> machine stops at the mountroot prompt on initial boot.
>>> 
>>> If there's a better way to pursue the same end I'd be grateful for
>>> a hint. Perhaps giving a swap size  parameter to firstboot? 
>> 
>> You have not reported what shows if you enter a "?" command at the
>> mountroot prompt. (As I remember that lists what mount root
>> classifies as available.)
>> 
>> That might prove to be useful information.
>> 
> 
> Indeed so. I've put a near transcript of a session at
> http://www.zefox.net/~fbsd/rpi2/rpi2_swap_installation
> 
> The punchline seems to be that in the course of resizing
> mmcsd0s2a and adding mmcsd0s2b the /dev/ufs/ device
> went away. Manually entering ufs:/dev/mmcsd0s2a allows
> a one-time mount and boot to multi-user.
> 
> I certainly didn't intentionally delete any files, the only
> change (apart from the rather drastic measures taken with
> gpart) was to rename /firstboot to /no.firstboot.
> 
> The only hint of possible mischief is:
> # gpart resize -i 2 mmcsd0
> GEOM_PART: mmcsd0s2 was automatically resized.
>  Use `gpart commit mmcsd0s2` to save changes or `gpart undo mmcsd0s2` to revert them.
> mmcsd0s2 reized
>         ^^^^^^
> [Note the misspelled message. I do not recall the prompt to commit from 2018]
> [The gpart man page implies commit is automatic, except using special options]
> 
> 
> Hopefully sharper wits than mine trained on the transcript will find the error.
> Some of the comments in growfs imply it takes a size parameter. That would help,
> but I couldn't recognize how to do it. 

The growfs description starts with:

DESCRIPTION
     The growfs utility makes it possible to expand an UFS file system.
     Before running growfs the partition or slice containing the file system
     must be extended using gpart(8). . . .

It does not change the partition size and so is used after
separately adjusting the partition size. (firstboot does
more than just growfs.)

After you get to either of:

# gpart show mmcsd0s2
=>        0  124939305  mmcsd0s2  BSD  (60G)
          0         41            - free -  (21K)
         41  121634816         1  freebsd-ufs  (58G)
  121634857    3304448            - free -  (1.6G)

or:

# gpart show mmcsd0s2
=>        0  124939305  mmcsd0s2  BSD  (60G)
          0         41            - free -  (21K)
         41  121634816         1  freebsd-ufs  (58G)
  121634857      27648            - free -  (14M)
  121662505    3276800         2  freebsd-swap  (1.6G)

you need to do the growfs for /dev/mmcsd0s2a .

Note: Some of the information may be stored at the
end of the partition, such as the information for
/dev/ufs/NAME (labeling). Thus the lack of a growfs
might explain the lack of the lack of the label: it
has not been moved to the right place yet.


===
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)



More information about the freebsd-arm mailing list