[[!meta title="Setting up swapcache"]] This page was created from my notes of setting up my SSD as a swapcache. I used the Intel 40 GB X25-V SATA II MLC. [[!toc]] # Formatting new drive for swap 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 at ata3-master SATA150 So our new drive is ad6. Now setup to the drive [[!color foreground=red text="**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)](http://leaf.dragonflybsd.org/cgi/web-man?command=swapcache§ion8) about leaving room on the drive for proper wear leveling. 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. # Adding Disk to fstab Edit /etc/fstab and comment out any existing 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 # Setting swapcache to start on boot To enable swapcache on boot edit /etc/sysctl.conf and add vm.swapcache.read_enable=1 vm.swapcache.meta_enable=1 See [swapcache(8)](http://leaf.dragonflybsd.org/cgi/web-man?command=swapcache§ion8) for other sysctl options like vm.swapcache.data_enable # Activating the swapcache The easiest way at this point is to just reboot the machine.