[linux-lvm] swap on lvm cache

Xen list at xenhideout.nl
Tue Apr 26 22:35:15 UTC 2016


Just a weird question here.

Since swap should ordinarily be encrypted if you encrypt any part of 
your data at all, I have opted at this point to either put it inside a 
volume that might end up getting cached, or to disable that cache and 
put the swap in its place.

What I am saying is that in my current scheme there is going to be a 
small cache drive and one part of the cache drive is going to serve 
unencrypted data and the other part is going to serve encrypted data.

Supposing that, the swap would be in the encrypted part. But using cache 
(lvmcache) on swap is completely ludicrous right?

Swap content might change so fast and so often that with regular 
parameters (that would need to be identical for the entire encrypted 
container) it would never make it to the cache.

More, accessing swap means loading it into RAM and then clearing the 
swap part. Therefore, theoretically perhaps unless the promotion values 
are 0, there would never be any benefit because swap is always write 
once read once.

Then again, that means there is no pain in adding swap to it either, 
because it will never get cached.

Maybe it could be considered an innocent or innocuous element. Doesn't 
hurt you, doesn't provide any benefit. In Dutch we say "Baat het niet, 
dan schaadt het niet."

Alternatively you could put the swap on the SSD (in this case) and not 
have any cache for the other part of the drive. What do you think? It 
makes no sense and it makes no difference, right.

Regards, Bart.




More information about the linux-lvm mailing list