To swap or not to swap ;-) (was RE: To lvm or not to lvm)

Matt Graham mhgraham at crow202.org
Fri Sep 21 13:51:00 MST 2018


On 2018-09-21 13:08, Carruth, Rusty wrote:
>> ....  You might even be able to get away without swap if you don't
>> want to do suspend-to-disk.
> 1 - one big (that is to say, at least your ram size, and possibly 2x
> your ram size) swap PARTITION is needed if you want to hibernate or
> suspend, and I think it has to be the first one in your fstab (but I'm
> not sure on that)

If you're using swsusp, your kernel command line needs to have 
"resume=/dev/sdb5" or wherever the partition you used to store the 
suspend image lives.  This can be any partition.  swsusp depends on LZO 
and should use it to compress the RAM image so that it won't ever be 
larger than your RAM size.  I can't find where anything in arch/x86/ is 
calling any compress/decompress functions though.

> 2 - swap files work fine, but can't be used for suspend/hibernate.

/usr/src/linux/Documentation/power/swsusp-and-swap-files.txt says that 
you can do this.  I have never tried to do this.  I guess it's time to 
run some experiments?

> 3 - suspend/hibernate doesn't work with multiple partitions if (the
> first one I think) isn't big enough to hold everything, even if the
> total swap space is plenty big.

Yes, this is correct, only 1 partition or file.

> 4 - not having swap seems to make some things not work too well

I have tried turning off swap before, and things have worked reasonably 
well, so long as I didn't try to do anything RAM-intensive like convert 
large images or run firefox.  I guess this depends on your workload.

-- 
Crow202 Blog: http://crow202.org/wordpress
There is no Darkness in Eternity
But only Light too dim for us to see.


More information about the PLUG-discuss mailing list