1 [[!meta title="Setting up swapcache"]]
3 This page was created from my notes of setting up my SSD as a swapcache.
4 I used the Intel 40 GB X25-V SATA II MLC.
8 # Formatting new drive for swap
10 After you install your drive you should be able to find it from dmesg.
11 For the Intel just grep on INTEL
14 ad6: 38166MB <INTEL SSDSA2M040G2GC 2CV102HB> at ata3-master SATA150
16 So our new drive is ad6.
17 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.**"]]
19 # dd if=/dev/zero of=/dev/ad6 bs=1k count=1
21 # disklabel64 -B -w -r ad6s1 auto
22 # disklabel64 -e ad6s1
24 Now you should be in your editor with the disklabel data.
25 Arrow down to the bottom of the screen.
26 You should see some sample labels
32 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.
40 # Adding Disk to fstab
42 Edit /etc/fstab and comment out any existing swap partitions. Just add a # in front of the line.
44 #/dev/serno/JPC550HN25.s1b none swap sw 0 0
46 Add your new device to fstab
48 /dev/ad6s1b none swap sw 0 0
50 # Setting swapcache to start on boot
52 To enable swapcache on boot edit /etc/sysctl.conf and add
54 vm.swapcache.read_enable=1
55 vm.swapcache.meta_enable=1
57 See [swapcache(8)](http://leaf.dragonflybsd.org/cgi/web-man?command=swapcache§ion8) for other sysctl options like vm.swapcache.data_enable
59 # Activating the swapcache
61 The easiest way at this point is to just reboot the machine.