Help with swap file management

  • Thread starter Deleted member 9563
  • Start date
D

Deleted member 9563

Guest
I am seeing messages in /var/log/messages saying kernel: swap_pager_getswapspace(4): failed. Also dmesg shows many lines of swap_pager_getswapspace(x): failed. Upon checking with swapinfo I see that swap usage is at 100%. I restarted Firefox (with all the same windows and tabs) and swap usage went down to 20%. That seems more reasonable, but if Firefox wants more swap, I'm ok with that since I have plenty of resources. The question then is how to add that.

The handbook is not clear to me. It describes how to add a swap file, but seems instead to be describing how to create a swap file in the first place. So I'm afraid to follow that in case it screws up my system.

The swap file I have is created according to Warren Block's succinct instructions, using this line # dd if=/dev/zero of=/usr/swap/swap bs=128k count=32768 which results in a 4G file. I would like to make that swap file 8G instead. How do I do that?
If I can just change that directly then fine, otherwise I have space on this or other drives which is suitable as well, and the idea of "adding" a swap file seems like a good one - if it's possible to do that.

PS: Perhaps there is some other issue here but my FreeBSD 11.1-RELEASE system with KDE and 16GB RAM is running very well and I see no harm in increasing swap if some program such as Firefox is happier with that.
 
About swapfile on Linux it's simple as: #fallocate -l 8G /swapfile
On FreeBSD I don't know since I use swap partition.
 
On FreeBSD I don't know since I use swap partition.
I would have used a swap partition, but this is an SSD and I wanted to run it through the file system and take advantage of TRIM.
 
The swap file I have is created according to Warren Block's succinct instructions, using this line # dd if=/dev/zero of=/usr/swap/swap bs=128k count=32768 which results in a 4G file. I would like to make that swap file 8G instead. How do I do that?
BS=128K and count=32768 which results in a 32768 * 128K = 4194304 K = 4096M = 4G large file. Don't change the blocksize. I'm sure you can calculate what the count needs to be for 8G.
 
dd if=/dev/zero of=/swapfile bs=2M count=4096
 
I am seeing messages in /var/log/messages saying kernel: swap_pager_getswapspace(4): failed.


The handbook is not clear to me. It describes how to add a swap file, but seems instead to be describing how to create a swap file in the first place. So I'm afraid to follow that in case it screws up my system.

I had the log message last week. I had added a 4G swap file onto another disk, and did it exactly as shown in 11.12 Adding Swap Space. Although I did not verify it, it seemed like the message occurred even during times when the machine was idle. This is my headless NAS machine so no X on it. Anyway after a reboot or two I ended up removing the swap file, and the error message has stopped.

EDIT: sorry I am wrong; I should have verified the log before I posted. My logg message was:
Code:
kernel: swap_pager: indefinite wait buffer:
 
Back
Top