Is it possible to use two swap partitions for multiple uses?
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Is it possible to use two swap partitions for multiple uses?
I want to add some security to my computer. And one thing that I want to do is have a random-key encrypted swap part. However, since I am currently working on a laptop, suspend-to-disk is very helpful. So I was wondering if it was possible to set up 2 partitions, one with random key encryption for normal swap functions and a second (either encrypted or plain text) to be used only for suspend to disk functions?
If this is possible, does anyone know how to set it up?
(Sorry if this is already out there. I could only find how to set up priority for normal swap use and not so that one partition is only used for one function.)
Some distro's can encrypt a swap. Why don't you just get rid of it? You might be able to use a swap file instead and it would be encrypted with the filesystem.
jefro, encrypting isn't the problem. I always use random key encrypted swap partitions, I was wondering if I could have a second swap that would be used for hibernate only that wasn't encrypted.
Mostly since I always encrypt my swap file with a random key due to some stuff I'm working on. I don't like having my stuff being able to to be read by someone at my computer besides me. A lot of the white hat stuff I'm working on could be taken the wrong way if it was found. However, I wanted the ability to suspend to hard disk sometime, I don't really do so, but I was curious if it was possible to set it up as such so I could have the best of both worlds.
When you suspend to your non-encrypted partition (provided you figure out how) would that not expose what you were working on? And even more vulnerable than normal swap as you will be dumping EVERYTHING currently in memory, not just what might overflow during normal usage.
When you suspend to your non-encrypted partition (provided you figure out how) would that not expose what you were working on? And even more vulnerable than normal swap as you will be dumping EVERYTHING currently in memory, not just what might overflow during normal usage.
Ken
While very true, the only time that I would use hibernate would be when I have a class that ends when dinner begins. That way I don't have to just use suspend which doesn't play well with my book bag (which is made out of duct tape).
Quote:
Originally Posted by DavidMcCann
Debian has a program (called hibernate!) for controlling hibernation. Try searching the web for "Debian hibernate" for various solutions.
If you need swap storage so you can load tons of memory to the disk under heavy load, and also to hibernate, you can just place a very big swap partition. With a swap of 150% the size of your RAM, you ensure that you can hibernate your laptop even when it is under heavy memory (>100%) consumption.
Now, if the laptop is dual-user, you can create two swap partitions and encrypt each of them with a different password, while encrypting the rest of the system with two passwords (LUKS volumes support multiple key slots, so they can be accessed by more than one password). Then, you could create two initrams, one pointing to one of the swap partitions and the other pointing to the second. Then, you should add entries to the boot loader so each initram is launchable, and tweak your boot scripts so the system is able to decide which swap to mount.
This way, you have a independent swap space for each user. User One knows a password, while user Two knows other password. They both can boot the system, but cannot launch the swap owned by the other user. This, however, is not a very good idea, because user One could hibernate to swap one, but user Two could turn the computer on later, make important modifications to the system and then turn ofF. When user One tried to resume his hibernation, he could face some errors.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.