Do I need Swap memory?

tomwin

Verified User
Joined
Apr 23, 2020
Messages
68
I do have Swap memory now, no need to be worried until next time i need to reboot, but i don’t need to reboot everyday so no need be worried. Because I little bit scare to edit my /fstab and insert /swapfile swap swap sw 0 0
But the first part was so easy, if needed to reboot I can install Swap memory again easy 👍
 

Attachments

floyd

Verified User
Joined
Mar 29, 2005
Messages
5,722
If you reboot the only thing you have to do is
Code:
swapon /swapfile
Assuming that /swapfile is the actual file you previously created.
 

tomwin

Verified User
Joined
Apr 23, 2020
Messages
68
I dig follow this

If you reboot the only thing you have to do is
Code:
swapon /swapfile
Assuming that /swapfile is the actual file you previously created.
I did insert this command in my terminal

dd if=/dev/zero of=/swapfile count=4096 bs=1MiB
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile

Do you mean I only need to insert this command now if I reboot?
swapon /swapfile
 

floyd

Verified User
Joined
Mar 29, 2005
Messages
5,722
dd if=/dev/zero of=/swapfile count=4096 bs=1MiB
chmod 600 /swapfile
mkswap /swapfile
These items do not need to be done again. They survive the reboot. The file still exists along with the permissions and the file is of type "swap." After a reboot just "swapon /swapfile."
 

tomwin

Verified User
Joined
Apr 23, 2020
Messages
68
I have learn so much here in this forum. Thank you everyone that helped me out.
 

sysdev

Verified User
Joined
Jul 16, 2007
Messages
204
OOM Killer will not necessarily keep the server from crashing. There have been plenty of times I had a server stop responding even though OOM Killer had killed stuff. The only thing I could do was power cycle it. I couldn't even login through the console. I saw plenty of stuff being killed by OOM Killer on the screen. It still crashed.
With very little memory it's always possible to have OOM kill important processes (sshd e.g.), but I have never seen anything other than apache of mysql getting killed on 4GB+ servers. But you do have some control about what processes it kills and what not by manipulating soms /proc/ settings.
 

floyd

Verified User
Joined
Mar 29, 2005
Messages
5,722
I am not going to argue with you over what what I have personally experienced.
 

sysdev

Verified User
Joined
Jul 16, 2007
Messages
204
I am not going to argue with you over what what I have personally experienced.
I have no intention to argue about anything with you. But it would be stupid to implement something in the kernel that would crash your server when it's supposed to prevent crashing and keep it in there for years. Anyway, have a nice day.
 

floyd

Verified User
Joined
Mar 29, 2005
Messages
5,722
But it would be stupid to implement something in the kernel that would crash your server
I never said OOM Killer would crash the server. I am saying that may not prevent it from crashing. Certainly it helps. But I have seen a server crash anyway despite OOM Killer stopping processes.
 
Top