Swap Disk Creation
Let’s create a swap file if there isn’t one on the server, it will help the game server run better.
Type the following, if your return is 0’s like below then you need to enable a swap file. This creates a swapfile of 2 gb, changing 2048 to the value you want by multiplying the gb’s you desire x 1024. 1 GB would be 1024, 4 gb would be 4096 and so on. It’s recommended to have equal or 2 x the swap to the physical memory on lower memory machines, so 2 gb machines would have 2 gb swap. Machines with 8+ gb physical memory may not need a swap file, but it’s always recommended to have a small one.
free |
cd /var sudo touch swap.img sudo chmod 600 swap.img sudo dd if=/dev/zero of=/var/swap.img bs=2048k count=1000 sudo mkswap /var/swap.img sudo swapon /var/swap.img sudo echo “/var/swap.img none swap sw 0 0” >> /etc/fstab sudo sysctl -w vm.swappiness=30 |