# swapon -s
Filename Type Size Used Priority
# free -m
total used free shared buffers cached
Mem: 3918 3755 162 0 73 342
-/+ buffers/cache: 3339 579
Swap: 0 0 0
ÀÌ¿ë°¡´ÉÇÑ µð½ºÅ© °ø°£ È®ÀÎ
# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda1 ext4 294G 126G 153G 46% /
none tmpfs 4.0K 0 4.0K 0% /sys/fs/cgroup
udev devtmpfs 2.0G 4.0K 2.0G 1% /dev
tmpfs tmpfs 392M 468K 392M 1% /run
none tmpfs 5.0M 0 5.0M 0% /run/lock
none tmpfs 2.0G 0 2.0G 0% /run/shm
none tmpfs 100M 0 100M 0% /run/user
¿øÇÏ´Â swap ÇÒ´ç·®¸¸Å ÁöÁ¤ÇÑ µð½ºÅ© °ø°£¿¡ »ý¼º
:: /swapfile À̸§À¸·Î 8g µð½ºÅ© °ø°£ »ç¿ë
# fallocate -l 8G /swapfile
root@controller:/var/log/tomcat7# ls -lh /swapfile
-rw-r--r-- 1 root root 8.0G 4¿ù 20 14:34 /swapfile
# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda1 ext4 294G 134G 145G 49% /
none tmpfs 4.0K 0 4.0K 0% /sys/fs/cgroup
udev devtmpfs 2.0G 4.0K 2.0G 1% /dev
tmpfs tmpfs 392M 468K 392M 1% /run
none tmpfs 5.0M 0 5.0M 0% /run/lock
none tmpfs 2.0G 0 2.0G 0% /run/shm
none tmpfs 100M 0 100M 0% /run/user
# ls -l /swapfile
-rw-r--r-- 1 root root 8589934592 4¿ù 20 14:34 /swapfile
root@controller:/var/log/tomcat7# chmod 600 /swapfile
# chmod 600 /swapfile
# ls -l /swapfile
-rw------- 1 root root 8589934592 4¿ù 20 14:34 /swapfile
# mkswap /swapfile
Setting up swapspace version 1, size = 8388604 KiB
# swapon /swapfile
# swapon -s
Filename Type Size Used Priority
/swapfile file 8388604 0 -1
# free -m
total used free shared buffers cached
Mem: 3918 3759 158 0 75 343
-/+ buffers/cache: 3340 577
Swap: 8191 0 8191
# vim /etc/fstab
/swapfile none swap sw 0 0
Âü°í
https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04