How much swap space for a 32 GB RAM system?
wblock at wonkity.com
Wed Jul 23 02:15:33 UTC 2014
On Wed, 23 Jul 2014, Polytropon wrote:
> This is how I did it: In order to keep things simple, I added
> the following to /etc/rc.local:
> /bin/rm -f $SWAP
> /bin/dd if=/dev/zero of=$SWAP bs=16m seek=1k count=0
> /sbin/mdconfig -a -t vnode -u 0 -f $SWAP || /bin/sh
> /bin/chflags nodump $SWAP
> /sbin/swapctl -a $SWAP
> And /etc/rc.shutdown.local cleans it up:
> /sbin/swapctl -d /dev/md0
> /sbin/mdconfig -d -u 0
> Suggestions for improvement?
It's not necessary to recreate the swap file on every boot, or manually
add it as swap or remove it as swap. Although there were some bugs
with the 9.X /etc/rc.d/swapfile, it normally just required some entries
in /etc/rc.conf. The swap file path, for example.
>>> configure it as a
>>> memory disk, and enable it with swapctl.
>> In 10.x, this can be done in /etc/fstab.
> This is on (or for) 10.0, how exactly does it work, which options
> are involved? Note that the above method has been "invented" for
> the use with SSDs in FreeBSD 8 and 9, so possibly it's easier to
> do something similar in FreeBSD 10...
In 10.0, Hiroki Sato set it up to do it all from /etc/fstab, and added a
bunch of examples to fstab(5). Here is my entry for a swap file:
md99 none swap sw,file=/usr/swap/swap 0 0
That's all. Well, the swap file has to be created before the first use.
md99 is used to avoid having md0 tied up for a swap file when I want to
mount an ISO.
More information about the freebsd-questions