Quote:
Originally Posted by devilboy09
these command will create a 1 MB swap file
|
Are you assuming the OP will understand how to scale up from the 1MB swap file you described to the desired size, and that the OP can estimate a good size?
The
bs=1024 in your example tells dd to work 1KB at a time, which is small and possible slow for creating a big file. The
count=1024 tells how big in units of
bs= to make the file.
The output from
free that was posted shows the 2GB swap space less than one quarter used, which would be OK.
But I think we are inferring from the vague info in the first post that at some other time the swap space was entirely used.
If 2GB of swap was used then adding 2GB more would not be generous. Having swap 2GB bigger than the most you've seen used is a reasonable safety margin. If the main disk were larger, I would suggest adding more than 2GB swap space now. But with only 61GB free disk space, I wouldn't want to be too generous with the safety margin on swap space.
If I understand
dd syntax properly, then using
bs=1M count=2048 would give a 2GB swap file instead of your 1MB example.
Since the system has only 1GB ram, the fact that it needs more than the 2GB swap it already has, may mean it is seriously underconfigured for the work it is doing, so adding swap will allow things to work that would have otherwise failed but they will only work slowly because 1GB is not enough ram.
Alternately, needing more than 2GB swap might indicate a memory leak in some program. Adding more swap space would reduce and delay the consequences of the memory leak and make the memory leak easier to diagnose. But it still doesn't diagnose itself. If you don't diagnose and correct it, even with added swap space, a memory leak will probably grow until it causes a serious failure.