• Recent
    • Docs
    • Github
    • 百度网盘
    • Onedrive
    • Official
    • Shop
    • Register
    • Login

    How to add swap file with cool pi 4b

    Scheduled Pinned Locked Moved Maker
    1 Posts 1 Posters 379 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • 大法师大
      大法师
      last edited by

      Swap is a space on a disk that is used when the amount of physical RAM memory is full. When a Linux system runs out of RAM, inactive pages are moved from the RAM to the swap space.

      Swap space can take the form of either a dedicated swap partition or a swap file. In most cases, when running Linux on a virtual machine, a swap partition is not present, so the only option is to create a swap file.

      Example Add 8GB swap memory

      sudo dd if=/dev/zero of=/swapfile bs=1M count=8096
      
      sudo chmod 0600 /swapfile
      
      sudo mkswap /swapfile 
      
      sudo swapon /swapfile
      
      echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
      
      

      sudo mount -a or reboot

      ubuntu@ubuntu:~$ free -h
                    total        used        free      shared  buff/cache   available
      Mem:          3.8Gi       3.2Gi       133Mi       110Mi       458Mi       443Mi
      Swap:         7.9Gi       1.0Mi       7.9Gi
      ubuntu@ubuntu:~$
      

      How to adjust the swappiness value

      refer info

      jack@cool-pi.com

      1 Reply Last reply Reply Quote 0
      • 1 / 1
      • First post
        Last post