swap file size

jcizzo

Explorer
Joined
Jan 20, 2023
Messages
79
I understand that TNC creates a small swap on the OS drives and then small swaps on all the other drives.

i don't like this arrangement at all.

does anyone know a way to set the swapfile system so that it resembles that of pfsense? i don't know why iX built the installer the way they did.

i want to perform a regular install and set the swap file on my OS drives at a size of my choosing and that's it. i don't want any swap space on any other drives. doesn't make any sense to me.

i know folks are gonna ask "why i wanna do it this way".. kinda not the point..

but for arguments sake, i have 2x 256GB SSDs as the OS drives. as you know, they're mirrored. i have 32GB ram... I want to have a 32GB swap partition to compliment the 32Gigs of ram.

yes, there are a few documents out there that show how to move it around etc.. but is there a way to stop all that completely and just have it all done at the installation so nothing gets put on the storage drives? again, just like it would be if it were a pfsense installation.

thanks!
 
Joined
Oct 22, 2019
Messages
3,641
i want to perform a regular install and set the swap file on my OS drives at a size of my choosing and that's it. i don't want any swap space on any other drives. doesn't make any sense to me.
so nothing gets put on the storage drives?
You can disable swap partition creation on your storage drives in the System -> Advanced menu.

However, there's another reason to partition a gigabyte or two on your storage drives. Because not all brands and models are the exact same size, having some space removed from your original data drives safeguards against trying to resilver with a replacement drive that's just barely too small to add into the pool.
 

jcizzo

Explorer
Joined
Jan 20, 2023
Messages
79
You can disable swap partition creation on your storage drives in the System -> Advanced menu.

However, there's another reason to partition a gigabyte or two on your storage drives. Because not all brands and models are the exact same size, having some space removed from your original data drives safeguards against trying to resilver with a replacement drive that's just barely too small to add into the pool.
ok but if i have a stack of all the same drives then..?

all in all, i'm not concerned about that, i just have a preference of how i want my OS drive and swap partitions setup
 
Joined
Oct 22, 2019
Messages
3,641
The System -> Advanced menu let's you change it to "0" (which disables it for newly added drives.)

As far as the boot drive(s) is concerned, it's either nothing or a 16GB swap partition during installation. (You'll likely never see any swap being used on TrueNAS Core, since it's FreeBSD-based and works in tandem with ZFS/ARC.)
 

rvassar

Guru
Joined
May 2, 2018
Messages
972
The System -> Advanced menu let's you change it to "0" (which disables it for newly added drives.)

As far as the boot drive(s) is concerned, it's either nothing or a 16GB swap partition during installation. (You'll likely never see any swap being used on TrueNAS Core, since it's FreeBSD-based and works in tandem with ZFS/ARC.)

Indeed... ZFS eats memory like it was created by IBM and not Sun. If you find yourself using swap on TrueNAS Core, you are running full speed into trouble. Your NAS should not be swapping. Not ever. If it is, you've probably undersized something, or are using it for something that isn't "NAS".
 

jcizzo

Explorer
Joined
Jan 20, 2023
Messages
79
yep, i get that.. but "should not be swapping. Not ever"...? i disagree with that. it certainly uses swap, not a lot, but it does use it. The rate arc fills up is an inverse relationship to how slow it can write the files out to the hard drives, which is also tied into how quickly your network connection is..

put another way, my media server has a dedicated direct 10G connection to the nas via DAC cable. when i copy a 50Gig movie from my media server to the nas, ARC fills itself up and swap gets called into service because A) i have 32gigs of ram and B) 5 HDDs in raidz2 can't keep up with the write speed.. so what started out as a 1GB (10Gb) transfer slows down to 200-250. yes, i can improve this by increasing ram but for the purposes of the nas, even 32gigs is more than enough.

my point is, swap gets used.

i like the swap being the same size as the RAM.. just a preference. if we can specify the size during a pfsense install (or freebsd install for that matter), i don't know why iX would change it around so that we couldn't do it with the install on truenas core.
 

rvassar

Guru
Joined
May 2, 2018
Messages
972
Not ever"...? i disagree with that. it certainly uses swap, not a lot, but it does use it. The rate arc fills up is an inverse relationship to how slow it can write the files out to the hard drives, which is also tied into how quickly your network connection is..
Disagree away. "Not ever" is the optimum. You really don't want to borrow memory from slow storage. It starts out less than optimum and goes down hill rapidly from there.

It's a problem as old as "swap". See: Swap Thrashing

my point is, swap gets used.

It does. And pay attention, it's a tell. The tell is you're outside some limit for some portion of your workload cycle.
i like the swap being the same size as the RAM.. just a preference. if we can specify the size during a pfsense install (or freebsd install for that matter), i don't know why iX would change it around so that we couldn't do it with the install on truenas core.

And this preference is fine. I can accept that. Given the storage required for the boot pool vs. the average retail SSD these days, I can see a new recommendation waiting in the wings. But it hasn't been made... Yet.

I'd recommend a mirrored SSD boot pool, and the majority slice of swap on that. There's no real need to spread swap out amongst the storage pools, if the boot pool goes down, swap is toast anyway. But that recommendation is not up to me. So I stick with my *nix curmudgeon position, swap is a tell that you're operating at the edge, if not outside, of your systems ability.
 
Top