Cara membuat swap di linux


Step by step :

  1. Alokasi swap $ sudo fallocate -l 1G /swapfile
  2. Set permission chmod 600 untuk swap $ sudo chmod 600 /swapfile
  3. Menandai swapfile di system linux sebagai swap $ sudo mkswap /swapfile
    Output :
    Setting up swapspace version 1, size = 1024 MiB (1073737728 bytes) no label, UUID=7e1faacb-ea93-4c49-a53d-fb40f3ce016a
  4. Enable swapfile $ sudo swapon /swapfile
    Output :

    swapon –show
    NAME       TYPE SIZE USED PRIO
    /swapfile    file 1024M 0B -2
  5. Set swap secara permanent di fstab $ sudo echo ‘/swapfile none swap sw 0 0’ | sudo tee -a /etc/fstab

Di tulis oleh: