Web lists-archives.com

Re: if you have no swap in your installation this is what you do??? Why???




Hi,

On Sun, Apr 09, 2017 at 02:58:00PM +0000, GiaThnYgeia wrote:
> 1	What is the difference functionally of having a swap partition from
> having a swap file?  Is it that you can use a separate physical disk
> that will take the wear and tear of swaping?

As long as the filesystem can support swapfiles then there is no
difference in functionality. You can put swap on a block device that
is from a separate physical device to the rest of your storage, or
in a swap  file on a filesystem that is on a separate physical
device to the rest of your storage, so that isn't a distinguishing
feature. It's just down to whatever is most convenient for you.

> 2	Is swap size relevant to ram, should it be equal, greater, smaller?
> Advantages disadvantages?  I rarely see in a workstation and my/our use
> anywhere close to 4GB being used, it usually maxes out around 2,5GB. No,
> no killing games here, maybe some chess and gnubg. Is it that a Ram of
> 1GB would benefit from 2-4GB swap space while with 16GB or Ram swap
> would never be used?

Opinions differ. More than 1GiB to me seems excessive regardless of
how much RAM you have. If you have 1GiB of data swapped out and you
need it again, it's going to take a really long time, which will
equate to dire performance. You'd be better off getting more memory
in that case.

Here is some useful discussion on the matter:

http://unix.stackexchange.com/a/190521

> 3	chmod 600 for the swapfile.  Why?

So that only the root user may read/write it. Swapped-out data can
contain sensitive information.

> 4	Is "dd bs=1M count=4M" that defines the 4,000Mb of space/size of the file?

That is units of 1024*1024 bytes, 4*1024*1024 times. Or
4*1024*1024*1024*1024 bytes. Or 4TiB. I'm guessing from below that
you meant bs=1K, in which case yes, that's 4GiB. This is all quicker
to test than to ask about though. :)

Cheers,
Andy

-- 
https://bitfolk.com/ -- No-nonsense VPS hosting