티스토리 뷰

Linux

swap 생성

CHOMAN 2018. 9. 11. 09:51

스왑 확인

swapon --summary

스왑 생성

fallocate -l 512M /swapfile
dd if=/dev/zero of=/swapfile bs=1M count=512
chmod 600 /swapfile
ls -a / | grep swapfile

-rw------- 1 root root 536870912 Feb 12 23:55 swapfile

mkswap /swapfile
swapon /swapfile

vim /etc/fstab

/swapfile none swap defaults 0 0

SWAP 파티션은 있는데 SWAP 안 잡혀 있는 경우

fdisk -l /dev/sda

Disk /dev/sda: 256.1 GB, 256060514304 bytes
255 heads, 63 sectors/track, 31130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0002d1d3

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          26      204800   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              26         548     4194304   82  Linux swap / Solaris
Partition 2 does not end on cylinder boundary.
/dev/sda3             548       31131   245658624   83  Linux
Partition 3 does not end on cylinder boundary.
# mkswap /dev/sda2
Setting up swapspace version 1, size = 4194300 KiB
no label, UUID=9b1ac36a-30ff-4aaf-832d-46ed4b2f56c1
# swapon /dev/sda2
blkid | grep swap
/dev/sda2: UUID="9b1ac36a-30ff-4aaf-832d-46ed4b2f56c1" TYPE="swap"

'Linux' 카테고리의 다른 글

이미지 매직 (ImageMagick) convert: no images defined 에러  (0) 2018.11.20
ulimit  (0) 2018.09.21
php 7 설치  (0) 2018.09.10
netconsole  (0) 2018.09.05
memcached  (0) 2018.08.29
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/04   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30
글 보관함