글 수 367
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 파티션으로 변경한다.
# 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)
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
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
/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)
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
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
/dev/sdb1 * 1 4462 35840983+ 82 Linux swap
Command (m for help): w
The partition table has been altered!
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
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