로그인
Sign in
1. swap파일시스템을 이용하기
# free
             total       used       free     shared    buffers     cached
Mem:        255300     231464      23836          0      22816      34928
-/+ buffers/cache:     173720      81580
swap:      1020116     199116     821000

# swapon -s
Filename                        Type            Size    Used    Priority
/dev/sda3                       partition       1020116 199116  -1

# umount /data

# fdisk /dev/sdb -> 기존에 사용하던 파티션중 하나를 swap 파티션으로 변경한다.

The number of cylinders for this disk is set to 4462.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): p
Disk /dev/sdb: 36.7 GB, 36703918080 bytes
255 heads, 63 sectors/track, 4462 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot    Start       End    Blocks   Id  System
/dev/sdb1   *         1      4462  35840983+  83  Linux
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 82
Changed system type of partition 1 to 82 (Linux swap)
Command (m for help): p
Disk /dev/sdb: 36.7 GB, 36703918080 bytes
255 heads, 63 sectors/track, 4462 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot    Start       End    Blocks   Id  System
/dev/sdb1   *         1      4462  35840983+  82  Linux swap
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.

# mkswap /dev/sdb1 -> /dev/sdb1에 swap 파일시스템 생성

Setting up swapspace version 1, size = 36701159 kB

# swapon /dev/sdb1 -> /dev/sdb1 swap 파일시스템을 활성화한다.

# free
             total       used       free     shared    buffers     cached
Mem:        255300     249548       5752          0      23036      35388
-/+ buffers/cache:     191124      64176
Swap:     36861088     199116   36661972

# swapon -s
Filename                        Type            Size    Used    Priority
/dev/sda3                       partition       1020116 199116  -1
/dev/sdb1                       partition       35840972        0       -2

# cat /etc/fstab
LABEL=/                 /                       ext3    defaults        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2
LABEL=/data             /data                   ext3    defaults        1 2
none                    /dev/pts                devpts  gid=5,mode=620  0 0
LABEL=/home             /home                   ext3    defaults        1 2
LABEL=/jms              /jms                    ext3    defaults        1 2
none                    /proc                   proc    defaults        0 0
none                    /dev/shm                tmpfs   defaults        0 0
LABEL=/tmp              /tmp                    ext3    defaults        1 2
/dev/sda3               swap                    swap    defaults        0 0
/dev/sdb1               swap                    swap    defaults        0 0
/dev/cdrom              /mnt/cdrom              udf,iso9660 noauto,owner,kudzu,ro 0 0
/dev/fd0                /mnt/floppy             auto    noauto,owner,kudzu 0 0

# swapoff /dev/sdb1 -> /dev/sdb1 swap 파일시스템 해제.

# free
             total       used       free     shared    buffers     cached
Mem:        255300     234344      20956          0      21928      37092
-/+ buffers/cache:     175324      79976
Swap:      1020116     199116     821000

# swapon -s
Filename                        Type            Size    Used    Priority
/dev/sda3                       partition       1020116 199116  -1

2. swap파일을 이용하기
# dd if=/dev/zero of=swapfile bs=1024 count=1000 -> swap으로 사용할 파일 생성
1000+0 records in
1000+0 records out

# ls -l swapfile
-rw-r--r--    1 root     root      1024000 Mar 24 00:22 swapfile
# mkswap swapfile -> swap 파일에 swap 파일시스템생성
Setting up swapspace version 1, size = 1019 kB

# swapon swapfile -> swap 활성화

# free
             total       used       free     shared    buffers     cached
Mem:        255300     180912      74388          0      19836      23132
-/+ buffers/cache:     137944     117356
Swap:      1021108     199140     821968

# swapon -s
Filename                        Type            Size    Used    Priority
/dev/sda3                       partition       1020116 199140  -1
/data/swapfile                  file            992     0       -3

# swapoff swapfile

# free
             total       used       free     shared    buffers     cached
Mem:        255300     180968      74332          0      19932      23148
-/+ buffers/cache:     137888     117412
Swap:      1020116     199140     820976

# swapon -s
Filename                        Type            Size    Used    Priority
/dev/sda3                       partition       1020116 199140  -1
조회 수 :
5838
추천 수 :
10 / 0
등록일 :
2008.10.09
14:08:34 (*.236.3.225)
엮인글 :
http://bestceok.com/xe/index.php?mid=unix_com&document_srl=2808&act=trackback&key=643
게시글 주소 :
http://bestceok.com/xe/index.php?mid=unix_com&document_srl=2808
List of Articles
번호 제목 글쓴이 날짜 조회 수
공지 자주 사용하는 명령어 제비게릴라 2019-06-27 20927
153 ftp 명령어 설명... 하록 2010-04-09 6622
152 hpacucli 사용법 하록 2010-04-08 8072
151 vsftpd home 접근제어... 하록 2010-04-02 5832
150 파일 시스템이 read only 로 마운트 됐을때... 하록 2010-01-27 5802
149 ping으로 서버 운영체제 알기... 하록 2009-12-17 5815
148 q4 분석 방법 하록 2009-07-10 5243
147 cannot restore segment prot after reloc: Permission denied 해결 방법 하록 2009-04-16 6931
146 xxxx.src.rpm 빌드하는 방법 하록 2009-04-09 5828
145 ethtool 설정 옵션... [2] 하록 2009-03-19 6562
144 HP-UX 11.00 시스템에서 이전 패치 제거 하록 2009-03-18 5558
143 HPUX 커널 설명... file 하록 2009-03-17 5820
142 Oracle 8i와 9i Startup 방법 하록 2008-10-30 6482
141 ndd 설정값 확인 하록 2008-10-29 5797
140 LVM Error 메세지 별 해결 방법 하록 2008-10-24 7415
139 vgexport와 vgimport 설명 하록 2008-10-22 7518
138 Netapp Disk Array 메세지 확인 법 하록 2008-10-15 5939
» 리눅스 스왑 생성 하록 2008-10-09 5838
136 System 온도가 OVERTEMP CRITICAL일때 root mail 등으로 경고 메세지를 받고자 합니다. 하록 2008-09-09 6314
135 RP 7410의 overtemp range 하록 2008-09-09 5939
134 HPUX 11i Version 정보... 하록 2008-08-20 8243