LoginSignup
1
0

More than 3 years have passed since last update.

Amazon Linux AMI に SWAP を作るコマンド

Last updated at Posted at 2018-12-12

毎回、毎回、超手抜きコマンド一覧です。

ひとまず 1GB。
変更したい場合は count=1024 の部分を変更。単位は MB。

スワップファイルの保存先は /swapfile に設定。変更する場合は、各業の文字列を変更してください。

sudo dd if=/dev/zero of=/swapfile bs=1M count=1024
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo sed -i -e "$ a /swapfile   swap        swap    defaults        0   0" /etc/fstab 

SWAP ファイルを増量する方法

SWAP ファイルを作り直します。

sudo swapoff /swapfile
sudo dd if=/dev/zero of=/swapfile bs=1M count=2048
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
1
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
1
0