I have a VPS with DreamHost, which is broadly working well, but I’d like some clarifications and advice about swap memory.
I see that there is no “swap space” enabled by default - which came as a surprise. The output of the “free” command, and “top” both agree that there is no swap. Output of “free” command is below: (I have configured the VPS to have 300Mb of RAM from the panel)
bash: free total used free shared buffers cached Mem: 307200 223512 83688 0 0 194576 -/+ buffers/cache: 28936 278264 Swap: 0 0 0
However, “swapon -s” and “cat /proc/swaps” seem to suggest that there is a swap partition on /dev/sda2 of size 7999996 (8Gbytes?). But device /dev/sda2 doesn’t seem to exist (ls /dev/sda2 reports no such file or directory).
I’m tempted to make a swap file (mkswap) and then ‘swapon’ it, and then add it to /etc/fstab so it gets mounted (or swapon’d, I suppose) automatically after a reboot.
Is this safe / recommended ? I am new to living in a virtual machine, and this likely has an impact on the decisions regarding swap.
Thanks in advance