Running Out of Swap Space?

Not open for further replies.


Feb 15, 2014
Recently, it looks like I'm running out of swap space for some reason, since I get the following message dumped to STDOUT hundreds of times: swap_pager_getswapspace(11): failed

root@freenas:~ # swapinfo
Device		  1K-blocks	 Used	Avail Capacity
/dev/mirror/swap0.eli   2097152  2090604	 6548   100%
/dev/mirror/swap1.eli   2097152  2090748	 6404   100%
/dev/mirror/swap2.eli   2097152  2091008	 6144   100%
/dev/mirror/swap3.eli   2097152  2090392	 6760   100%
/dev/mirror/swap4.eli   2097152  2091580	 5572   100%
Total			10485760 10454332	31428   100%

I'm currently on FreeNAS-11-MASTER-201802100419, I have 40 GB allocated to my FreeNAS VM, so I don't see why it's using swap. I guess the ARC is gobbling up it all?

I created a 20 GB ZVOL to use as additional swap space, but FreeBSD won't let me turn it on for some reason. I found a Oracle doc stating to use a ZVOL for swap, so is that Solaris only?

root@freenas:~ # swapon -a /dev/zvol/storage/swap
swapon: /dev/zvol/storage/swap: Operation not supported by device

root@freenas:~ # zfs get all storage/swap
storage/swap  type					volume				  -
storage/swap  creation				Tue Feb 13 11:43 2018   -
storage/swap  used					20.6G				   -
storage/swap  available			   13.6T				   -
storage/swap  referenced			  112K					-
storage/swap  compressratio		   1.00x				   -
storage/swap  reservation			 none					default
storage/swap  volsize				 20G					 local
storage/swap  checksum				on					  default
storage/swap  compression			 lz4					 inherited from storage
storage/swap  readonly				off					 default
storage/swap  copies				  1					   default
storage/swap  refreservation		  20.6G				   local
storage/swap  primarycache			all					 default
storage/swap  secondarycache		  all					 default
storage/swap  usedbysnapshots		 0					   -
storage/swap  usedbydataset		   112K					-
storage/swap  usedbychildren		  0					   -
storage/swap  usedbyrefreservation	20.6G				   -
storage/swap  logbias				 latency				 default
storage/swap  dedup				   off					 default
storage/swap  mlslabel										-
storage/swap  sync					always				  inherited from storage
storage/swap  refcompressratio		1.00x				   -
storage/swap  written				 112K					-
storage/swap  logicalused			 6K					  -
storage/swap  logicalreferenced	   6K					  -
storage/swap  volmode				 default				 default
storage/swap  snapshot_limit		  none					default
storage/swap  snapshot_count		  none					default
storage/swap  redundant_metadata	  all					 default
storage/swap  org.freebsd.ioc:active  yes					 inherited from storage

I just looked at htop and swap is 99.7% used....but there are 2.6 GB of RAM free.

I'm thinking this may be a bug.
Last edited:


Aug 22, 2012
11.1 had a memory leak that was filling my swap.
I added a crontab script that monitors the log and reboots whenever swap allocation fails (I forget the exact error message).
11.1-U1 closed the memory leak and I have indeed seen less swap use, but there is still some. Under 9 I had no swap use.

I suspect there is still a bug. I haven't been running for long enough to be sure yet, but I think the biggest swap increases are when a scrub starts. I think I'm due for that tomorrow.
Not open for further replies.