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

From: Matthew Seaman <matthew_at_FreeBSD.org>
Date: Wed, 24 May 2023 14:54:14 UTC
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