• Home
  • About
    • lahuman photo

      lahuman

      열심히 사는 아저씨

    • Learn More
    • Facebook
    • LinkedIn
    • Github
  • Posts
    • All Posts
    • All Tags
  • Projects

Centos7 swap 메모리 설정

11 Aug 2020

Reading time ~1 minute

Centos7 swap 메모리 설정

1. swapfile 생성

$ fallocate -l 2GB /swapfile

fallocate 명령어로 생성 안될 경우 아래 명령어로 생성. count 뒷부분이 swap file 용량

$ dd if=/dev/zero of=/swapfile count=5096 bs=1MiB

2. swap file 권한 설정

$ chmod 600 /swapfile

3. 스왑 포맷 형태로 파일 변환

$ mkswap /swapfile

4. 스왑 파일 시스템 등록

$ swapon /swapfile

5. 등록된 swap memory 확인

$ swapon --summary
$ free -h

6. 스왑 파일 삭제

6-1. 스왑 사용 비활성화

$ swapoff swapfile

6-2. 스왑 파일 삭제

$ rm /swapfile

다음 부팅시 스왑 공간을 사용하지 않게 /etc/fstab 에 등록된 항목도 삭제 해야 합니다.

참고 자료

  • Swap Memory 추가하기 (CentOS 7)


centos7swap Share Tweet +1