Skip to content
Htkyama Blog

Raspberry Piのswapを無効にする

Raspberry Pi1 min read

Raspberry Piのswapを無効にする方法。


Raspberry Piの型とOSのバージョンを確認。

$ cat /proc/device-tree/model
Raspberry Pi 3 Model B Rev 1.2
$ lsb_release -a
No LSB modules are available.
Distributor ID: Raspbian
Description: Raspbian GNU/Linux 10 (buster)
Release: 10
Codename: buster


swap offした後に、dphys-swapfileのサービスを停止、無効にする。

$ sudo swapoff --all
$ sudo systemctl stop dphys-swapfile
$ sudo systemctl disable dphys-swapfile
Synchronizing state of dphys-swapfile.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install disable dphys-swapfile
Removed /etc/systemd/system/


$ systemctl status dphys-swapfile
● dphys-swapfile.service - dphys-swapfile - set up, mount/unmount, and delete a swap file
Loaded: loaded (/lib/systemd/system/dphys-swapfile.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:dphys-swapfile(8)
$ free
total used free shared buff/cache available
Mem: 999812 71784 727412 6692 200616 867108
Swap: 0 0 0
© 2023 All rights reserved.