리눅스 우분투 SWAP 스왑메모리 생성 방법

atlantic.net 클라우드 호스팅을 사용하는데

우분투로 다시 provisioning 하고 나서 free -m 쳐보니. 스왑메모리가 디폴트로 생성이 안된다.

따로 만들어 줘야 한다.

현재 물리적 메모리가 1기가이니 2기가로 만들어줘야 겠다.

Ubuntu 14.04 에서 SWAP 생성하기

1. 스왑으로 사용할크기 할당

dd if=/dev/zero of=/swapfile bs=1024 count=2048k

2.스왑파일 지정

mkswap /swapfile

3.스왑파일 활성

swapon /swapfile

4.서버가 재시작될때 자동으로 스왑이 활성화 되게 하려면
다음 파일을 편집하여 “/swapfile none swap sw 0 0” 내용을 맨 아래 추가한다.

sudo nano /etc/fstab

샘플

# /etc/fstab: static file system information.
#
# Use ‘blkid’ to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda1 during installation
UUID=29d4f7ec-33c0-4b23-bbea-ea0a887d2fdf / ext4 noatime,e$
/swapfile none swap sw 0 0

 

참고: https://www.atlantic.net/community/howto/add-a-swap-file-on-ubuntu-14-04/

리눅스 우분투 SWAP 스왑메모리 생성 방법
Scroll to top