0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

メモリスワップを作る。Ubuntuでやってます。

Posted at

次の記事を書くための自分用メモです。
よく忘れるので。

小さなインスタンスで立ち上げているので、まずはUpdateより前にメモリスワップを作ります。
2GBのswapファイル作成

sudo dd if=/dev/zero of=/swapfile bs=1M count=2048 status=progress

パーミッション設定

sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

永続化

echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab

これはいいのかわかっていませんが、
swappiness調整(デフォルト60→10に下げる。メモリ使い切るまでswap使わんようにする)

echo 'vm.swappiness=10' | sudo tee -a /etc/sysctl.conf
sudo sysctl -p

確認

free -h
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?