Swap files created but not used

CmdrDeLiver

Cadet
Joined
Mar 25, 2021
Messages
3
Hi everyone,

So I installed TrueNAS-12.0-U2.1 on a testing rig. This is for learning purposes and the hardware is not production. 16G ECC, G2020T, HPE Microserver Gen8, 1.5T hdd, 1.0T hdd, and 500G sdd.

During boot, it offered to make a 16G swap partition - yes. So it created the partition and doesn't use it. Instead it is using much smaller 2G parts spread across the data drives.

Questions:

Why is a swap partition made but not used?

What is the recommended way to add and persist it across reboots?

gpart show => 40 2930277088 ada0 GPT (1.4T) 40 88 - free - (44K) 128 4194304 1 freebsd-swap (2.0G) 4194432 2926082696 2 freebsd-zfs (1.4T) => 40 1953525088 ada1 GPT (932G) 40 88 - free - (44K) 128 4194304 1 freebsd-swap (2.0G) 4194432 1949330696 2 freebsd-zfs (930G) => 40 976773088 ada2 GPT (466G) 40 1024 1 freebsd-boot (512K) 1064 33554432 3 freebsd-swap (16G) 33555496 943194112 2 freebsd-zfs (450G)

swapinfo Device 1K-blocks Used Avail Capacity /dev/mirror/swap0.eli 2097152 0B 2.0G 0%
 

pschatz100

Guru
Joined
Mar 30, 2014
Messages
1,184
Swap is where the system puts files it needs to access when all the RAM is full of other data. If you have enough RAM in your system, then the swap space will not be used. This is the way it is supposed to be. If there were no swap, and your system RAM became full then the system would crash. 2G of swap space allocated per disk is the FreeNAS/TrueNAS default. Just leave it as is.
 

Forza

Explorer
Joined
Apr 28, 2021
Messages
81
Swap is where the system puts files it needs to access when all the RAM is full of other data. If you have enough RAM in your system, then the swap space will not be used. This is the way it is supposed to be. If there were no swap, and your system RAM became full then the system would crash. 2G of swap space allocated per disk is the FreeNAS/TrueNAS default. Just leave it as is.
Is this swap space redundant in a mirror or raid fashion like the data disks would be in a pool? Otherwise on a disk fail the system could crash because of the swap. IMHO that doesn't seem safe.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
Is this swap space redundant in a mirror
Yes, at least with the swap partitions on the pool disks--they're mirrored and have been for some time now.
 
Top