Re: zfs-on-root, missing swap (fixed subject)

From: Arthur Chance <freebsd_at_qeng-ho.org>
Date: Wed, 24 May 2023 16:24:23 UTC
On 24/05/2023 15:54, Steven Friedrich wrote:
> On 5/24/23 10:54 AM, Matthew Seaman wrote:
>> On 24/05/2023 14:20, Steven Friedrich wrote:
>>> On 5/24/23 8:59 AM, Steven Friedrich wrote:
>>>> Just this morning, I installed 13.2 on a USB 500 GB SSD  I changed
>>>> swap size from 2GB to 128GB.
>>>>
>>>> Running synth to install kde5, noticed several build fails and synth
>>>> claims swap is n/a.
>>>>
>>>> Checked both df and mount, no swap shown.  Also swapinfo shows no swap.
>>>>
>>>> Where did it go?
>>
>> What's the result of `gpart show /dev/ada0` ?  (Assuming ada0 is the
>> correct device name for your SSD device.)
>>
>> You should see something like this:
>>
>> ```
>> # gpart show /dev/ada0
>> =>       34  976773101  ada0  GPT  (466G)
>>          34          6        - free -  (3.0K)
>>          40        984     1  freebsd-boot  (492K)
>>        1024   16776352     2  freebsd-swap  (8.0G) <<<-----****
>>    16777376  959995752     3  freebsd-zfs  (458G)
>>   976773128          7        - free -  (3.5K)
>> ```
>>
>> which tells you the allocated swap area is /dev/ada0p2.  You should
>> then be able to add a line in /etc/fstab like so:
>>
>> /dev/ada0p2 none swap sw 0 0
>>
>> and then run:
>>
>> `service swap start`
>>
>> More complicated setups are possible, like swapping to a gmirror
>> across partitions on two physical drives, or using glabel to name the
>> partition -- useful if you have removable drives that can upset the
>> device numbering.
>>
>> It's not advisable to swap to a ZFS or to a file held on ZFS:
>> performance will be bad and you run the risk of system lockups where
>> ZFS will demand more swap before it can provide access to the swap area.
>>
>> 128GB is (I think) the absolute maximum configurable swap size in
>> FreeBSD 13.2 -- generally it's advisable to limit swap to about the
>> same as RAM on systems with more than 4GB RAM.  See tuning(7).
>>
>>     Cheers,
>>
>>     Matthew
> 
> Thanks for the response.  I already discovered the problem.  I was
> installing from a USB stick, whuch was assigned da0.  When I rebooted, I
> pulled that and the SSD became da0, instead of da1.
> 
> All I had to do was edit /etc/fstab and change da1p3 to da0p3. 8o)

It makes a lot of sense to use GPT labels to avoid that sort of problem.
They remain the same even if disk numbering changes.

> I also re-installed because it was complaining about swap size. I
> re-installed with only 64GB swap.
> 

-- 
We build our computer systems the way we build our cities; over time,
without a plan, on top of ruins.
			— Ellen Ullman