라즈베리 파이를 사용하다 보면,
memory부족으로 인한 OOM(Out of Memory)을 자주 만나게 된다.
OOM을 피하기 위해서 swap 크기를 늘려서 memory 증가와 같은 효과를 만들 수 있다.
먼저, 아래 명령어를 통해서 swap-off 한다.
$ sudo dphys-swapfile swapoff
/etc/dphys-swapfile 파일을 편집해서 swap 크기를 지정한다.

CONF_SWAPSIZE 값을 원하는 값으로 조정한다. 단위는 [MB]이다.
다시 swap-on 하고,
$ sudo dphys-swapfile swapon
free 명령어로 확인하면, 입력한 대로 swap disk 크기가 변한 것을 알 수 있다.
$ free -h
total used free shared buff/cache available
Mem: 1.8Gi 166Mi 308Mi 848Mi 1.3Gi 766Mi
Swap: 499Mi 3.0Mi 496Mi
※ 출처
https://linuxhint.com/increase-memory-raspberry-pi/
How to Increase Memory on Raspberry Pi
The low memory issue is one of the significant problems for Raspberry Pi users who use the Raspberry Pi model with 2GB or 4GB RAM. The low memory issue directly slows down the performance of the applications running on the Raspberry Pi system. The ideal wa
linuxhint.com
.
'Linux > RaspberryPi Server' 카테고리의 다른 글
| [RaspberryPi] Booting 時 해상도 자동 설정 (0) | 2025.09.07 |
|---|---|
| [RaspberryPi] Network Manager 고정 IP 설정 (0) | 2024.02.04 |
| [NAS서버 만들기][#7] DLNA 설정 (삼성 TV 접속)(OMV6) (0) | 2024.02.04 |
| [NAS서버 만들기][#6] SFTP 설정 (외부 접속)(OMV6) (0) | 2024.02.04 |
| [NAS서버 만들기][#5] SMB/CIFS 설정 (로컬 네트워크 접속)(OMV6) (0) | 2024.02.04 |