Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
0
Help us understand the problem. What is going on with this article?
@jumpe1

swapの作成方法

概要

業務でswap領域を作る機会があったので自分用メモ。

環境

  • Centos7

swap作成

ddコマンドで指定サイズの空ファイルを作成。

// 1GBの場合
$ dd if=/dev/zero of=/swapfile bs=1M count=1024
// 2GBの場合
$ dd if=/dev/zero of=/swapfile bs=1M count=2048

$ chmod 600 /swapfile

mkswap:作成したファイルをスワップ領域として使用できるようにする。
swapon:スワップ領域を有効化。

$ mkswap /swapfile
$ swapon /swapfile

サーバ起動時に有効にする設定。再起動して有効になっている確認します。

$ vim /etc/fstab
↓
/swapfile               swap                   swap    defaults        0 0

$ reboot
$ free -m

参考になったサイト

0
Help us understand the problem. What is going on with this article?
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
jumpe1

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
0
Help us understand the problem. What is going on with this article?