Linux - (15) : swap

­이승환·2021년 8월 11일
0

리눅스 정리

목록 보기
15/21

swap


예제

1 STEP) - Swap을 위한 파일의 생성

[root@Linux]# dd if=/dev/zero of=/shared/volume1/2G-SWAP

2 STEP) - Swap의 생성

[root@Linux]# mkswap /shared/volume1/2G-SWAP

3 STEP) - Swap의 실행

[root@Linux]# swapon /shared/volume1/2G-SWAP

4 STEP) - Swap의 실행상태 확인

[root@Linux]# cat /proc/swaps

5 STEP) - Swap제거와 확인

[root@Linux]# swapoff /shared/volume1/2G-SWAP
[root@Linux]# cat /proc/swaps

6 STEP) - Swap Device를 rebooting시에 등록

/etc/fstab 에 파일시스템을 등록
(생략...)

/etc/rc.d/rc.local 파일에 위에서 실행했던 내용을 등록

[root@Linux]# cat ./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.
`
[ -f /etc/sysconfig/msec ] && source /etc/sysconfig/msec
[ -z "$SECURE_LEVEL" ] && SECURE_LEVEL=3

# Source functions
. /etc/init.d/functions

if [ -f /etc/sysconfig/network-scripts/ifcfg-eth1 ]; then
    /etc/rc.d/rc.ford
fi   

if [ -f /etc/sysconfig/network-scripts/ifcfg-eth1 ]; then
    /etc/rc.d/init.d/named start
fi   

if [ -f /dev/cdrom ]; then
   hdparm -c 0 -d 0 /dev/cdrom
fi
if [ -f /dev/dsp ]; then
  chmod 666 /dev/dsp
fi 
touch /var/lock/subsys/local

# Swap device 생성

mkswap /shared/volume1/2G-SWAP

swapon /shared/volume1/2G-SWAP

NOTE

Swap device는 2G 제한이 있다고 한다.

profile
Mechanical & Computer Science

0개의 댓글