树莓派的swap大小在/etc/dphys-swapfile
中定义,默认为100M
pi@raspi:~$ cat /etc/dphys-swapfile
CONF_SWAPSIZE=1000
pi@raspi:/mnt$ free -h
total used free shared buffers cached
Mem: 437M 36M 401M 0B 2.1M 12M
-/+ buffers/cache: 22M 415M
Swap: 99M 0B 99M
pi@raspi:/mnt$
可以自己修改CONF_SWAPSIZE
的值,单位为兆(MB)
修改后重启树莓派生效,如下:
pi@raspi:~$ cat /etc/dphys-swapfile
CONF_SWAPSIZE=1000
pi@raspi:~$ free -h
total used free shared buffers cached
Mem: 437M 53M 383M 0B 7.9M 23M
-/+ buffers/cache: 22M 415M
Swap: 999M 0B 999M