Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In order to save disk space, I want to have two OS installations share a single swap partition (a dual-boot). Is this a good idea?

share|improve this question
Get more ram, it's cheap, don't use swap, it'll help you with that IO issue. I realize this might not be feasible, but gone are the days where you must have swap. – xenoterracide Jan 11 '11 at 10:10
@xeno that perf issue has nothing to do with swap; look at botton of ur answer for an example; oh, and I'm not running out of RAM either – Tshepang Jan 11 '11 at 11:01
@xeno if u dont have swap, u lose Suspend ability – Tshepang Jan 11 '11 at 11:04
I don't use that, so... yeah I don't use that. – xenoterracide Jan 11 '11 at 11:11
if you're swapping it means (well can mean) heavy IO, heavy IO kills performance. – xenoterracide Jan 11 '11 at 11:13
up vote 29 down vote accepted

It's possible. In fact, you can share the swap space between completely different operating systems, as long as you initialize the swap space when you boot. It used to be relatively common to share swap space between Linux and Windows, back when it represented a significant portion of your hard disk.

Two restrictions come to mind:

  • The OSes cannot be running concurrently (which you might want to do with virtual machines).
  • You can't hibernate one of the OSes while you run another.
share|improve this answer

One side effect I can think of is:

  1. Hibernate system1 (using the swap partition for hibernation).
  2. Boot system2.

You could lose data.

share|improve this answer
Murphys law suggests that if you do this, you will one day forget, you will hibernate an OS, or boot it into a VM, and you will hose your system, and possibly data. Simple truth - disk space is dirt cheap, your data and work is probably not. Unless you are needing terabyte's of swap space for each OS, just make separate ones. – Danny Staple Jan 11 '11 at 9:57

One of my friends have tried this. He has installed five or six distros in a single Hard drive.

The first primary partition is for GRUB and he is able to boot to all the distros. The second partition is swap. The third partition is an extended partition and each of the distros is installed into their own logical partitions.

All of the distros are booting and can hibernate. I think you just need to make sure and select the correct distro after resuming from hibernation.

So, on the basis of his experiment I should say YES. This is possible.

But i think it can break things. What if distro 2 wakes up and distro 1's resume file is using up the swap partition, what's the next thing going to happen?
So i too agree with all the above posts. Why dont you try to split the swap parttions, rather than taking this huge risk.

share|improve this answer
check the question again: "is it a good idea?" VS "is it possible" – Tshepang Jan 11 '11 at 14:39
this also means you are essentially repeating what @shellholic said – Tshepang Jan 11 '11 at 14:43
@Tshepang: I was actually thinking from the point of its possibility. Its my mistake. Will edit the answer appropriately. – Sen Jan 11 '11 at 14:50
Before you respond, check the other answers, to ensure you don't repeat what they said. – Tshepang Jan 11 '11 at 14:54
I never actually Suspend. I really wanted to know if there were other issues I wasn't thinking of. – Tshepang Jan 11 '11 at 15:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.