どういうこと?
Raspberry PiはストレージがSDカードなので、読み書きを大量にしているとちょっと寿命的に気になる。
そのため無駄な読み書きをなくすためにswapを無効化したほうが良さそう!
(実際にRaspberry PiでKubernetesクラスタを作る手順とかでもswapは無効化してる)
swap状況を確認してみる
以下のコマンドでswap状況を見てみる
free -h
表示はこんな感じ
total used free shared buff/cache available Mem: 927M 95M 210M 37M 621M 730M Swap: 99M 3.5M 96M
100MBぐらいのswap領域を確保しているようだ。
swapを無効化する
以下のコマンドで不要なパッケージ及び領域を削除する
sudo swapoff --all sudo apt-get purge -y --auto-remove dphys-swapfile sudo rm -fr /var/swap
swap無効化後の状況を確認してみる
free -h
表示はこんな感じ
total used free shared buff/cache available Mem: 927M 95M 91M 40M 740M 727M Swap: 0B 0B 0B
バッチリ!
swap領域がなくなったのでこれでok.