Enable SWAP

Hi,

Sorry i have silly question :D

Really i didnt know how to enable SWAP on my FreeBSD box... Is there any tutorial to enable SWAP. NOTE: i just checked my SWAP with htop and it always showing 0B

Thanks
 
in /etc/fstab add somthing like this
Code:
/dev/[red]ad0s2b[/red] none swap sw 0 0
change text in red to fit your setup


now either reboot or simply run # swapon /dev/ad0s2b
 
If you have enough internal memory your swap will hardly get touched. This is good because using swap will slow things down. If you have a lot of paging in/out of your swap you need to consider adding more memory to the machine.

swapinfo(8)
 
SirDice said:
If you have enough internal memory your swap will hardly get touched. This is good because using swap will slow things down. If you have a lot of paging in/out of your swap you need to consider adding more memory to the machine.

swapinfo(8)

Indeed. Thrashing your cache so that things swap will reduce your performance on your system a _lot_. Also, you can use any combination of swapctl(8), swapoff(8), and swapon(8) to manage swap files / partitions.

Have fun ;)...
 
freebsd 11.3 current top output:
Mem: 509M Active, 202M Inact, 16K Laundry, 230M Wired, 70M Buf, 23M Free
Swap: 1024M Total, 1024M Free

I don't understand why system aren't using swap partition although it's enabled and in use?
 
You may want to consider using encrypted swap. I run my laptop entirely in ram, 4GB system with typical 1.5GB used during general use, swap infrequently gets used, but sometimes is. I allocate a 26GB swap file, so when I do the likes of video editing it has enough 'ram' (otherwise would tend to just lock up/grind to a halt). In cases where swap is used typically the system initially slows right down for a few minutes as things are swapped - but then resumes working pretty much a usual. Shutdowns can also be slow, as the system swap off's (flushes). You just have to be patient.
 
I don't understand why system aren't using swap partition although it's enabled and in use?
Without giving us any info on the load of that setup (for example: what do you got running in there?) it's impossible to tell. If you only have one service running I wouldn't be surprised here.

You may want to consider using encrypted swap.
Within context of what's being asked that's a pretty dumb suggestion because it doesn't add any improvements nor does it answer proton's question. I suppose it could add up to the total load which makes their system use swap but I don't think that was the goal of all this.

And for the record: I'm not saying there's no merit within encrypted swap, there can be, but not within the context of the question. It adds plain out 0 advantages which leads me to my previous comment. Not to mention that you failed to explain how to set this up. Making your comment plain out useless, once again within context of course.

(edit): and why are we reviving a 9 year old thread?
 
Without giving us any info on the load of that setup (for example: what do you got running in there?) it's impossible to tell. If you only have one service running I wouldn't be surprised here.
Pretty standard stuff like apache + mariadb + php but as far as I can see from TOP output only 23 mbytes left of 1024 mbytes of physical ram so usually in such cases swap is used. In my case swap is on dedicated partition, contents of /etc/fstab are: /dev/vtbd0p3 none swap sw 0 0
(edit): and why are we reviving a 9 year old thread?
Do you prefer to create a new thread with a similar name? :)
 
Pretty standard stuff like apache + mariadb + php but as far as I can see from TOP output only 23 mbytes left of 1024 mbytes of physical ram so usually in such cases swap is used.
No, not necessarily. Your internal memory will always be used as much as possible and most of the time it's filled up with all sorts of caches. These cashes are the first to be released when a process requires a bunch of memory. When you start to hit some limits then first a bunch of inactive process will get swapped out, it's going to depend on what you have running how much swap this will use.

In your case I'm almost certain there's actually some swap in use but the numbers are so low that rounding errors are making it seem like there's nothing used.

In my case swap is on dedicated partition
Where and how your swap is stored is mostly irrelevant.
 
Without giving us any info on the load of that setup (for example: what do you got running in there?) it's impossible to tell. If you only have one service running I wouldn't be surprised here.


Within context of what's being asked that's a pretty dumb suggestion because it doesn't add any improvements nor does it answer proton's question. I suppose it could add up to the total load which makes their system use swap but I don't think that was the goal of all this.

And for the record: I'm not saying there's no merit within encrypted swap, there can be, but not within the context of the question. It adds plain out 0 advantages which leads me to my previous comment. Not to mention that you failed to explain how to set this up. Making your comment plain out useless, once again within context of course.

(edit): and why are we reviving a 9 year old thread?
And your value add ... negative
 
Back
Top