Disable Swap Creation on New Pools

bhadreshl

Dabbler
Joined
Jul 6, 2015
Messages
10
This advanced option was available in the 20.** release, but I am unable to locate in the 21.** release.

Could someone please help with finding a system tunable that will disable swap creation on new pools?

Thanks,
 

izomiac

Dabbler
Joined
May 3, 2018
Messages
19
I'm going to bump this because I can't find it either.

And before anyone starts, I personally don't have a problem with reserving space in case the replacement drive has diminished capacity, albeit in practice that means it has enough reallocated sectors to indicate it's near death. What I do have an issue with is putting swap on data disks. My system has an excess of RAM, so using swap means a process is having a memory leak and needs to be killed. Furthermore, a drive dying or having a bad read in swap easily leads to a system crash, it precludes hotswapping, you can't wipe the disk, it prevents disk spin-down, it increases your disk IO and subsequent wear, and you have to really get in the guts of the system to verify that swap is encrypted so your passwords aren't being written in plain text. It causes tons of problems for no gain, so I have always disabled it.
 

Chris3773

Dabbler
Joined
Nov 14, 2021
Messages
17
I could not find the option in the GUI however you can change the value using the API.

Create an API key under the root user.

Then you can use a curd command to call the API for changing the swap partition size to 0 disabling swap for pools.
Code:
curl -X PUT -d "{\"swapondrive\": 0}" -H "Content-Type: application/json" -H "Authorization: Bearer {{APIKEY}}" https://{{TRUE SCALE IP}}/api/v2.0/system/advanced



Remember to remove the API key from the root user once done. You will need to recreate the pool to remove existing swap partitions.
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
or you could just do it from the CLI/shell...

midclt call system.advanced.update '{"swapondrive": 0}'
 

shog

Cadet
Joined
Oct 13, 2017
Messages
8
Sorry to resurrect this, but it was very helpful, thanks.

Why is there no mention of this in the install guides?
When can we have an "expert mode" for install?

I went through devices at 32,64,128 and finally 250GB before I was offered the ability to have a swap partition, of a size I wasn't able to modify in any way. Really? 250GB? That is outrageous for a Linux system, even more so for a freebsd one. Why can't I have (say) 32GB for OS + 16 or so for swap on a 64GB drive?

And why, if I've allowed it a drive big enough to create a swap does it *still* want to create 2GB partitions on my data disks which may or may not be connected / disconnected?

Leave a simple mode as a default, but please, please, please give us an expert mode so we can make our own decisions based on (in my case) 30 years plus of managing linux & storage systems. I have fabricated machines at work for systems doing 4GB/sec data warehouse roles, but always have to bend or break the "rules" to allow me to configure the system as I want to.
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
Why is there no mention of this in the install guides?
All versions of TrueNAS place a small (2GB by default) swap partition on all pool member disks... it's been this way for a decade or so.

When can we have an "expert mode" for install?
In TrueNAS core, it's there in the settings in the GUI.

For SCALE, you have the method above. I guess the GUI may arrive at some point.

I went through devices at 32,64,128 and finally 250GB before I was offered the ability to have a swap partition, of a size I wasn't able to modify in any way. Really? 250GB? That is outrageous for a Linux system, even more so for a freebsd one. Why can't I have (say) 32GB for OS + 16 or so for swap on a 64GB drive?
Personally, I'm not concerned about SWAP, since it will never be used in a system I'm managing (as I deliberately manage it to not do that).

And why, if I've allowed it a drive big enough to create a swap does it *still* want to create 2GB partitions on my data disks which may or may not be connected / disconnected?
See my first point... It's probably no longer necessary, but that hasn't been addressed yet by the developers.

Leave a simple mode as a default, but please, please, please give us an expert mode so we can make our own decisions based on (in my case) 30 years plus of managing linux & storage systems. I have fabricated machines at work for systems doing 4GB/sec data warehouse roles, but always have to bend or break the "rules" to allow me to configure the system as I want to.
This isn't a "complaints for the developers forum", it's community support/discussion. If you want to address the developers, you need to raise a bug/feature request from System Settings, General, File Ticket so it can be handled in Jira.
 

shog

Cadet
Joined
Oct 13, 2017
Messages
8
All versions of TrueNAS place a small (2GB by default) swap partition on all pool member disks... it's been this way for a decade or so.


In TrueNAS core, it's there in the settings in the GUI.

For SCALE, you have the method above. I guess the GUI may arrive at some point.


Personally, I'm not concerned about SWAP, since it will never be used in a system I'm managing (as I deliberately manage it to not do that).


See my first point... It's probably no longer necessary, but that hasn't been addressed yet by the developers.


This isn't a "complaints for the developers forum", it's community support/discussion. If you want to address the developers, you need to raise a bug/feature request from System Settings, General, File Ticket so it can be handled in Jira.
It wasn't meant to be a complaint to the DEVs, more of a whine and I apologise if any offense has been taken. I, too, always set swap to 0 on the core systems, and always have. I was frustrated at not being able to find the setting in the GUI.

I was very surprised at the sheer size of boot device at which it is finally possible to create a swap partition.

As to expert mode, I was just wishing that it might become possible to be able to use partitions of drives to add to pools as log, cache, or other special vdevs in the GUI rather than having to manually set these up. Earlier, I'd cloned my boot usb to 2 x 500GB SSDs that I wanted to split across log devices and a separate pool potentially for VMs, partitioned up and set it all up and then decided I wanted to re-order. On excision of the vm pool, the partitions on the SSDs were completely erased, rendering it unbootable. So I'll probably go with a single boot ssd albeit on a USB3-sata adapter, with the 2 internal devices as a log device and VM pool. And yes, I use both iscsi vdevs and NFS VM stores exported to other machines making log devices extremely useful in my use case.
 
Top