Linux

swap 늘리기

Naan 2016. 7. 15. 16:50
반응형

리눅스에서 swap 늘리기

 

기존 swap 이 16G이다

# swapon -s, free

Filename                                Type            Size    Used    Priority

/dev/sdb3                               partition       16980696        104924  -1

 

이걸 32G로 늘려보자

 

# dd if=/dev/zero of=/경로/스왑파일명 count=2048 bs=1M

 

# mkswap -f /경로/스왑파일명

Setting up swapspace version 1, size = 16383995 kB

 

# swapon /work/swapfile

# swapon -s, free

Filename                                Type            Size    Used    Priority

/dev/sdb3                               partition       16980696        104924  -1

/경로/스왑파일명                          file            15999992        0       -2

 

재부팅하면 풀리니깐 등록해주자

 

# vi /etc/rc.local

#!/bin/sh

#

# This script will be executed *after* all the other init scripts.

# You can put your own initialization stuff in here if you don't

# want to do the full Sys V style init stuff.

 

swapon /경로/스왑파일명   --> 추가

rc.local 말고 etc/fstab 에도 등록 가능하다.

# vi /etc/fstab

/work/swapfile          swap                    swap    defaults        0 0
추가

 

 

 

 

반응형