021c2cffa9fe0ed71ba81a838cb1978f456edb36
[ikiwiki.git] / docs / howtos / swapcache / index.mdwn
1 [[!meta title="Setting up swapcache"]]
2
3 This page was created from my notes of setting up my SSD as a swapchache.
4 I used the Intel 40 GB X25-V SATA II MLC.
5
6 [[!toc]]
7
8 # Formatting new drive for swap
9
10 After you install your dive you should be able to find it from dmesg.
11 For the Intel just grep on INTEL
12
13     # dmesg | grep  INTEL
14     ad6: 38166MB <INTEL SSDSA2M040G2GC 2CV102HB> at ata3-master SATA150
15
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.**"]]
18
19     # dd if=/dev/zero of=/dev/ad6 bs=1k count=1
20     # fdisk -BI ad6
21     # disklabel64 -B -w -r ad6s1 auto
22     # disklabel64 -e ad6s1
23
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
27
28     # EXAMPLE
29     #a:          4g          0    4.2BSD
30     #a:          *           *    4.2BSD
31
32 After the last line add :
33
34     b:  *       0       swap
35
36 Now save the file.
37
38 Create a new file system on your drive.
39
40     # newfs /dev/ad6s1b
41
42 # Adding Disk to fstab
43
44 Edit /etc/fstab and comment out any exisiting swap partitions. Just add a # in front of the line.
45
46     #/dev/serno/JPC550HN25.s1b          none            swap    sw              0       0
47
48 Add your new device to fstab
49
50     /dev/ad6s1b          none            swap    sw              0       0
51
52 # Setting swapcache to start on boot
53
54 To enable swapcache on boot edit /etc/sysctl.conf and add
55
56     vm.swapcache.read_enable=1
57     vm.swapcache.meta_enable=1
58     vm.swapcache.data_enable=1
59
60 See [swapcache(8)](http://leaf.dragonflybsd.org/cgi/web-man?command#swapcache&section8) for other sysctl options.
61
62 # Activating the swapcache
63
64 The easiest way at this point is to just reboot the machine.
65
66