LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This 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


Reply
  Search this Thread
Old 09-04-2011, 08:12 PM   #1
texasone
Member
 
Registered: Jun 2008
Location: /home/lorax
Distribution: Debian Testing
Posts: 141

Rep: Reputation: Disabled
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.)

Thanks in advance,
RzITex
 
Old 09-04-2011, 10:35 PM   #2
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,993

Rep: Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628
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.
 
Old 09-04-2011, 11:32 PM   #3
texasone
Member
 
Registered: Jun 2008
Location: /home/lorax
Distribution: Debian Testing
Posts: 141

Original Poster
Rep: Reputation: Disabled
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.
 
Old 09-05-2011, 12:18 AM   #4
SalmonEater
Member
 
Registered: Jun 2010
Location: Up the Big River w/o paddle
Distribution: Salent & Slackel
Posts: 131

Rep: Reputation: 19
I don't know how one could be earmarked for a particular usage, but I've used more than one at once.

+1 jefro => why? Just curious?
 
Old 09-05-2011, 04:16 AM   #5
texasone
Member
 
Registered: Jun 2008
Location: /home/lorax
Distribution: Debian Testing
Posts: 141

Original Poster
Rep: Reputation: Disabled
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.
 
Old 09-05-2011, 11:18 AM   #6
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 2,127

Rep: Reputation: 174Reputation: 174
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
 
Old 09-05-2011, 12:00 PM   #7
DavidMcCann
LQ Veteran
 
Registered: Jul 2006
Location: London
Distribution: PCLinuxOS, Debian
Posts: 6,142

Rep: Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314
Debian has a program (called hibernate!) for controlling hibernation. Try searching the web for "Debian hibernate" for various solutions.
 
Old 09-05-2011, 02:36 PM   #8
texasone
Member
 
Registered: Jun 2008
Location: /home/lorax
Distribution: Debian Testing
Posts: 141

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by taylorkh View Post
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 View Post
Debian has a program (called hibernate!) for controlling hibernation. Try searching the web for "Debian hibernate" for various solutions.
I shall have to take a look at that. Thank you
 
Old 09-05-2011, 04:21 PM   #9
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,993

Rep: Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628
Guess you could make a script to un-swap and re-swap before you hibernate.
 
Old 09-07-2011, 06:32 AM   #10
BlackRider
Member
 
Registered: Aug 2011
Posts: 295

Rep: Reputation: 101Reputation: 101
I am not sure if I understand this.

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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Those of you with multiple Linux distros across multiple partitions ... SlowCoder General 14 05-15-2009 03:24 PM
Multiple SWAP partitions: what is priority number?? coolblue Linux - Newbie 1 05-01-2007 02:26 PM
eight swap partitions? linuxtesting2 Linux - General 7 07-20-2004 06:15 AM
Swap partitions 2k. Linux - General 7 03-01-2004 05:59 PM
Multiple swap partitions? [GOD]Anck Slackware 10 01-01-2004 11:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration