Skip to content

Instantly share code, notes, and snippets.

@aliemre
Last active August 22, 2023 00:41
Show Gist options
  • Select an option

  • Save aliemre/fa2f58e3d79667b7386d3051b3680400 to your computer and use it in GitHub Desktop.

Select an option

Save aliemre/fa2f58e3d79667b7386d3051b3680400 to your computer and use it in GitHub Desktop.
Make a Swap and Remove a Swap
# Swap Yaratmak
df -h
sudo dd if=/dev/zero of=/swapfile bs=1k count=2048k
sudo mkswap /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo 'echo "/swapfile none swap defaults 0 0" >> /etc/fstab' | sudo sh
free -m
# Swap'ı Kapatmak
sudo swapoff -v /swapfile
sudo rm /swapfile
# Swap’i kapatmaya çalışırken aşağıdaki gibi hata alabilirsiniz.
# swapoff: /swapfile: swapoff failed: Cannot allocate memory
# Swap dosyası RAM’in büyüklüğünden fazla olduğu için bu hatayı vermekte.
# O yüzden bu yöntemle kapatamazsınız. Kapatmak için Swap dosyasını kalıcı hale getirmek için yaptığınız değişikliği hatırlayın.
# Bu değişikliği geri almalıyız.
# “/etc/fstab” altında bulunan aşağıdaki satıra benzer satırı silelim, kaydedelim ve sistemi yeniden başlatalım.
# /swapfile none swap sw 0 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment