Skip to content
TheChatArchiveThe Chat Archive
DeepSeekdeepseek-v3-0324· DeepSeekHugging Face LMArena Human Preference 140K

How to permanently disable swap on debian?

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Mistralmistral-small-3.1-24b-instruct-2503’s answer.
  1. User

    How to permanently disable swap on debian?

  2. DeepSeek Assistant

    To permanently disable swap on Debian, follow these steps:

    1. Check Current Swap Usage

    sudo swapon --show
    free -h
    

    This will list active swap partitions/files.

    2. Temporarily Disable Swap

    sudo swapoff -a
    

    This turns off all swap devices immediately.

    3. Permanently Remove Swap Entries

    Edit /etc/fstab to comment out or remove swap entries:

    sudo nano /etc/fstab
    

    Look for lines containing swap and either:

    • Comment them out (add # at the start):
      # /dev/mapper/vg0-swap none swap sw 0 0
      
    • Or delete them entirely.

    Save (Ctrl+O, Enter) and exit (Ctrl+X).

    4. (Optional) Remove Swap Partition or File

    If you want to completely remove the swap partition/file:

    • For a swap partition:

      sudo fdisk /dev/sdX  # Replace X with your disk (e.g., sda)
      

      Delete the swap partition and save changes.

    • For a swap file:

      sudo rm /swapfile
      

    5. Verify Swap is Disabled

    free -h
    sudo swapon --show
    

    If swap is disabled, no entries should appear.

    6. (Optional) Disable ZRAM Swap (if used)

    If using ZRAM (common on newer Debian installs), disable it:

    sudo systemctl disable --now zramswap
    

    7. Reboot (Optional)

    sudo reboot
    

    After reboot, verify again with free -h.

    Conclusion

    Now swap is permanently disabled on your Debian system. If you later need to re-enable it, reverse these steps (uncomment in /etc/fstab and run swapon -a).

    Let me know if you need further assistance!

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.