Swap memory: Difference between revisions

From 탱이의 잡동사니
Jump to navigation Jump to search
No edit summary
Line 48: Line 48:
Swap:        1953          0      1953
Swap:        1953          0      1953
</source>
</source>
== Enable hibernate ==
절전모드 활성화 하기
<pre>
$ cd /var/lib/polkit-1/localauthority/50-local.d/
$ sudo vi com.ubuntu.enable-hibernate.pkla
</pre>
<pre>
[Re-enable hibernate by default in upower]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes
[Re-enable hibernate by default in logind]
Identity=unix-user:*
Action=org.freedesktop.login1.hibernate
ResultActive=yes
</pre>
=== Change lid option ===
Hibernate your laptop when lid is closed
<pre>
$ sudo vi /etc/systemd/logind.conf
</pre>
And change the line
<source lang=bash>
#HandleLidSwitch=suspend
HandleLidSwitch=hibernate
</source>
<pre>
$ sudo restart systemd-logind
</pre>


== See also ==
== See also ==
* http://www.linux.com/news/software/applications/8208-all-about-linux-swap-space - All about Linux swap space
* http://www.linux.com/news/software/applications/8208-all-about-linux-swap-space - All about Linux swap space
* http://askubuntu.com/questions/94754/how-to-enable-hibernation - How to enable hibernation?
* http://askubuntu.com/questions/94754/how-to-enable-hibernation - How to enable hibernation?
* http://ubuntuhandbook.org/index.php/2014/04/enable-hibernate-ubuntu-14-04 - How to Enable Hibernation in Ubuntu 14.04


== References ==
== References ==

Revision as of 23:18, 7 September 2015

Overview

Swap 메모리 관련 내용 정리

Swap memory

Swap메모리는 주 메모리가 부족할 때 하드디스크와 같은 공간을 메모리로 사용하기 위한 가상 메모리이다.(윈도우에선 가상 메모리(페이징 메모리)라고 지칭함)

Check swap memory

free 명령어로 현재 설정되어 있는 swap 메모리 공간의 크기를 확인할 수 있다. <source lang=bash> pchero@earth:/etc$ free -m

            total       used       free     shared    buffers     cached

Mem: 1000 923 77 82 12 315 -/+ buffers/cache: 594 405 Swap: 1953 0 1952 </source>

Swap memory 늘리기

Swap 메모리 영역을 확보하기 위해서는 2가지 방법이 있다.

- Swap partition 구성하는 방법.
- Swap file 생성 후, swap 영역으로 지정하는 방법.

Swap file

이미 파일 시스템을 구성한 이후라면, 스왑 파티션을 생성하는 것이 부담스러울 수 있다. 이런 경우, 간단하게 스왑 파일을 생성하여 스왑 영역으로 사용하면 된다.

<source lang=bash> pchero@earth:/home$ sudo dd if=/dev/zero of=/home/swapfile bs=1024 count=2000000 2000000+0 records in 2000000+0 records out 2048000000 bytes (2.0 GB) copied, 6.53252 s, 314 MB/s

pchero@earth:/home$ ls -sh total 2.0G 4.0K pchero 2.0G swapfile

pchero@earth:/home$ sudo mkswap /home/swapfile Setting up swapspace version 1, size = 1999996 KiB no label, UUID=7373fad5-bfca-4bb9-b8e7-2a92cf17fa7d

pchero@earth:/home$ sudo swapon /home/swapfile swapon: /home/swapfile: insecure permissions 0644, 0600 suggested.

pchero@earth:/home$ free -m

            total       used       free     shared    buffers     cached

Mem: 1000 935 64 82 6 338 -/+ buffers/cache: 590 409 Swap: 1953 0 1953 </source>

Enable hibernate

절전모드 활성화 하기

$ cd /var/lib/polkit-1/localauthority/50-local.d/
$ sudo vi com.ubuntu.enable-hibernate.pkla
[Re-enable hibernate by default in upower]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes

[Re-enable hibernate by default in logind]
Identity=unix-user:*
Action=org.freedesktop.login1.hibernate
ResultActive=yes

Change lid option

Hibernate your laptop when lid is closed

$ sudo vi /etc/systemd/logind.conf

And change the line <source lang=bash>

  1. HandleLidSwitch=suspend

HandleLidSwitch=hibernate </source>

$ sudo restart systemd-logind

See also

References

<references />