Help us understand the problem. What is going on with this article?

Raspberry Pi -RASPBIAN- のswapを無効化

More than 3 years have passed since last update.

概要

Raspberry Pi -RASPBIAN- のSwapを無効にする方法の覚書

目的

マイクロSDカードの延命。
スワップは高速化への貢献が少ないわりにSDカードに負担をかけるとのこと。

環境

raspberry pi2(jessie)

基本方針

SwapをDisableする
リブートしてもDisable状態は継続されること。
簡単に復活できる道も残しておくこと。

実際の手順

1. dphys-swapfile

RaspbianではSwapの制御は/soin/dphys-swapfileで行っているらしい。
$ free
total used free shared buffers cached
Mem: 882800 400092 482708 12776 38404 195952
-/+ buffers/cache: 165736 717064
Swap: 102396 0 102396
$ sudo dphys-swapfile swapoff
$free
total used free shared buffers cached
Mem: 882800 402544 480256 12820 39272 197656
-/+ buffers/cache: 165616 717184
Swap: 0 0 0
ちなみスワップを復活する場合は、
$ sudo dphys-swapfile swapon
でOK。RAM容量不足でエラーになる場合のおまじない。

2.サービスの静止

/soin/dphys-swapfileは自動起動されるよう設定されているので、ラズパイを再起動するとスワップが復活する。
$ insserv -s | grep dphys-swapfile
S:03:2 3 4 5:dphys-swapfile
そこで自動起動を停止。
$ sudo insserv -r dphys-swapfile

結果

再起動して確かめてみる。
$ free
total used free shared buffers cached
Mem: 882800 732492 150308 12780 237420 323308
-/+ buffers/cache: 171764 711036
Swap: 0 0 0

参考にさせて頂いたWEBページ

http://raspberrypi.stackexchange.com/questions/169/how-can-i-extend-the-life-of-my-sd-card
http://denshikousaku.net/extend-life-expectancy-of-raspberry-pi-sd-card
http://hanposaki.blog.so-net.ne.jp/2013-01-07

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした