Visit the LQ Articles and Editorials section
Go Back > Forums > Linux Forums > Linux - Desktop
User Name
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.


Search this Thread
Old 11-25-2008, 09:10 AM   #1
Stuart Morrow
LQ Newbie
Registered: Oct 2006
Location: Ireland.
Distribution: Various distros
Posts: 5

Rep: Reputation: 0
Possible to share the swap partition between two installations if I hibernate?

This is just a question out of curiousity and daydreaming, rather than seeking help to a problem, so there's no urgency to respond.

I know that if you have two Linux distros installed on the same computer you can share the swap between them, since obviously only one of them would be active at a given time.
I know that you can share a swap partition between Linux and Hurd dual boot the same way as between two Linuxes, and I know that you can share a swap partition between Linux and BSD if you do a mkswp in the Linux's startup or the BSD's shutdown.

But I was wondering, can you share a swap partition between two Linux installations if you do hibernation (to disk) on one or both, rather than shutting down? And, does it depend on which implementation of hibernation you're using in either or both?

Just wondering,
Old 11-25-2008, 11:48 AM   #2
Junior Hacker
Senior Member
Registered: Jan 2005
Location: North America
Distribution: Debian testing Mandriva Ubuntu
Posts: 2,687

Rep: Reputation: 59
I like using Bootitng as a boot manager, it makes compressed images of the partitions. This comes in handy for answering questions like this by trial and error. If it doesn't work and I can't re-boot, I spend under ten minutes zeroing out the affected OS/partition and re-load the image I made before I screwed it up without breaking a sweat or raising my stress level.
But I'm too lazy at the moment, and it's not something I desire to know at this particular time.
Just showing you how to figure it out on your own, "trial & error".
Old 11-26-2008, 04:36 AM   #3
Senior Member
Registered: Jul 2007
Location: Directly above centre of the earth, UK
Distribution: SuSE, plus some hopping
Posts: 3,910

Rep: Reputation: 776Reputation: 776Reputation: 776Reputation: 776Reputation: 776Reputation: 776Reputation: 776
Originally Posted by Stuart Morrow View Post
But I was wondering, can you share a swap partition between two Linux installations if you do hibernation (to disk) on one or both, rather than shutting down? And, does it depend on which implementation of hibernation you're using in either or both?
I think that should break things, although maybe in slightly subtle ways. If distro 2 wakes up and distro 1's resume file is using up the swap partition, what's it supposed to do? Maybe it detects that the resume file is its own and that's not what you want, or maybe it detects it as a 'foreign' resume file and just doesn't use that part or all of the swap and that probably isn't what you want, either.

So, I can't really see a good outcome, unless you had way more swap that you needed, in which case why not divide it into two?
Old 11-27-2008, 11:16 AM   #4
Registered: Nov 2008
Location: UK
Distribution: RHEL, Fedora
Posts: 68

Rep: Reputation: 12
I might be wrong, but if you hibernate one OS, then GRUB will only start that OS up again. You won't be given the opportunity to boot to the other OS.


Last edited by mikey99; 11-27-2008 at 11:27 AM.
Old 11-28-2008, 03:35 AM   #5
Registered: Jan 2008
Location: Southern Oregon
Distribution: Laptop: DesktopBSD1.6, openSuse11, Mandriva, Mepis7, BackTrack3....USB: Mandriva2009, Debian-Lenny,
Posts: 82

Rep: Reputation: 16
More than one swap

I did that one time, not intentionally, but the other distro tried to resume from the previous disto's hibernation. It froze on the boot, but when I rebooted, it seemed as though the swap had been cleared out. I think that if you intend to hibernate frequently with both (or more) distros, you might want to consider creating more than one swap partition. The problem that arises is that when you install a distro, many will mount both swap partitions, and will make the first one recognised as the default one. This will require you editing the menu.lst, fstab, as well as configuration files for the resume to swap (disk) functions. Just make sure when you install and customize the partitioning, you unmount the swap partitions you do not want the system to recognise or format them with a live cd as something other than swap, and change it back after install formatting it to a swap partition..
Old 01-02-2009, 11:31 PM   #6
Registered: Jan 2009
Distribution: Fedora, Ubuntu, Mint, Sabayon
Posts: 34

Rep: Reputation: 15
Shared Swap and Hibernation

I have experimented with this. I have a laptop hard drive and have installed seven different distros. The first primary partition is for grub and I am 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 just need to make sure and select the correct distro after resuming from hibernation. So, yes. This is possible


hibernation, sharing, suspend, swap

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
F7: Hibernate using new swap partition Mleahy Linux - Software 2 07-26-2008 02:16 PM
Can a multi-boot system share a swap partition? sirius57 Suse/Novell 6 05-26-2006 08:37 PM
quick question: Does hibernate requires swap partition? carboncopy Linux - Laptop and Netbook 5 09-18-2005 06:35 AM
Share swap partition - Linux and Windows XP jasontn Linux - Newbie 8 02-20-2004 08:52 AM
Can I share a swap partition between mdk and rh? mark_umr Linux - General 7 10-31-2002 07:50 AM

All times are GMT -5. The time now is 04:27 PM.

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