• Support
  • Is it safe to delete file "swap" in folder www?

I have 2 servers, 2 with same version and configuration. But only in one of them, it has this file in it:
root/www/swap

It has 1Gb of space. Is it safe to delete it? What is it? Can i manually delete it or via app/config in aapanel?

    aaP_erikator
    It's a swap file that provides virtual memory space. When physical RAM gets full, the system uses this space as additional memory (it depends on the how high the swappiness is), and having 1GB of swap space is a common configuration.

    If you want to delete it, first you need to see the current swap usage (not recommend to delete if it's used):

    free -h

    then you can properly remove it through terminal / ssh:

    sudo swapoff /root/www/swap
    sudo rm /root/www/swap

      aaP_erikator
      If you have enough physical memory to handle both server, then swap file isn't necessary. Remember, virtual memory is slower than physical memory (especially if you're still using harddisk) but it's a good solution when you have a limited RAM. You can adjust it based on your preference.

        aaP_radipta289
        I just checked, both my servers show using swap memory. But only in one of them has swap file in www folder. Where is the other one? I havent touched anything

          aaP_erikator

          First, check all active swap locations:

          sudo swapon --show

          This will show the full path and type (file/partition) of all active swap spaces.

          To see if it's a partition or file:

          free -h
          lsblk | grep SWAP

          Share the result

            aaP_radipta289
            Oh i see, one is in root folder, one is in www folder.

            I thought aapanel configuration by default should be same? I havent touched any special configuration

              aaP_erikator
              it's fine. I suggest not to interfere with that swap configuration.

              Based on your case, I think:

              • One server might have had the swap file created during OS installation
              • The other might have had it created during aaPanel installation or later