Use memory card as RAM (swap memory)

Use memory card as RAM (swap memory)

Chỉnh phân vùng SWAP trên thẻ nhớ để giảm tải cho RAM. Sử dụng bộ nhớ thiết bị để cache giúp hệ thống tạm thời không bị quá tải

Sử dụng thẻ nhớ làm bộ nhớ đệm mở rộng cho RAM, tránh tình trạng lag hệ thống khi nhiều dịch vụ phải hoạt động cùng lúc trong thời gian ngắn

Xem dung lượng ram được sử dụng: $ htop hoặc free --mega

Tăng dung lượng RAM

Disable the swap file:

sudo dphys-swapfile swapoff

sudo nano /etc/dphys-swapfile

Khai báo Swapfile

SWAP_SIZE=1G && SWAP_FILE=/swapfile && sudo swapoff -a && sudo rm -rf $SWAP_FILE && sudo fallocate -l $SWAP_SIZE $SWAP_FILE && sudo chmod 600 $SWAP_FILE && sudo mkswap $SWAP_FILE && sudo swapon -a

Enable the swap file:

sudo dphys-swapfile swapon

Create a new swap file:

sudo dphys-swapfile setup

You've successfully subscribed to Geek Playground
Great! Next, complete checkout for full access to Geek Playground
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info is updated.
Billing info update failed.