jetson Nano swap 변경하기(가상메모리변경)
HW : jetson nano
OS : ubuntu 18.04
jetson은 ubuntu에서 사용하는 swapfile을 사용하지 않고 zram이라는 것을 이용하여 관리한다.
많은 사람들이 swap을 늘리기 위해 ubuntu의 swapfile을 만들어 사용하는데 jetson의 booting시 사용하는 "/etc/systemd/nvzramconfig.sh"을 반경하고 rebooting하는것으로 간단하게 변경할 수 있다.
1. /etc/systemd/nvzramconfig.sh이용
- step01 : sudo vi /etc/systemd/nvzramconfig.sh
- step02 : .... 중간에 "/ 2 /"가 보이는데 "/ 1 /" 로 변경하고 저장하고 나옴 (다음 재부팅)
- step 03 : free -m
2. swap file 이용
- step01 : sudo fallocate -l 4G /var/swapfile
- step02 : sudo chmod 600 /var/swapfile
- step03 : sudo mkswap /var/swapfile
- step04 : sudo swapon /var/swapfile
- step05 : sudo bash -c 'echo "/var/swapfile swap swap defaults 0 0" >> /etc/fstab'
- step06 : reboot
참고 :
1의 원문
The 2GB swap memory that it created by default is zram, so it uses compression to store pages in memory. It is recommended to keep the zram-to-memory ratio at 1:2 (i.e. 1/2 of RAM). However, you could edit this behavior in the startup script found at /etc/systemd/nvzramconfig.sh, or by manually using mkswap/swapon with the /dev/zram* files (which is what the nvzramconfig script does internally).