This page was created from my notes of setting up my SSD as a swapchache. I used the Intel 40 GB X25-V SATA II MLC.
After you install your drive you should be able to find it from dmesg. For the Intel just grep on INTEL
# dmesg | grep INTEL ad6: 38166MB <INTEL SSDSA2M040G2GC 2CV102HB> at ata3-master SATA150
So our new drive is ad6. Now setup to the drive If you choose the wrong device you might/WILL destroy all your data on that disk.
# dd if=/dev/zero of=/dev/ad6 bs=1k count=1 # fdisk -BI ad6 # disklabel64 -B -w -r ad6s1 auto # disklabel64 -e ad6s1
Now you should be in your editor with the disklabel data. Arrow down to the bottom of the screen. You should see some sample labels
# EXAMPLE #a: 4g 0 4.2BSD #a: * * 4.2BSD
After the last line you will add your SSD setup, see the WARNINGS section of swapcache(8) about leaving room on the drive for proper wear levelling. For the 40GB drive 32GB should be the max size used for the cache.
Add this line.
b: 32g 0 swap
Now save the file.
Edit /etc/fstab and comment out any exisiting swap partitions. Just add a # in front of the line.
#/dev/serno/JPC550HN25.s1b none swap sw 0 0
Add your new device to fstab
/dev/ad6s1b none swap sw 0 0
To enable swapcache on boot edit /etc/sysctl.conf and add
See swapcache(8) for other sysctl options like vm.swapcache.data_enable
The easiest way at this point is to just reboot the machine.