LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  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,
Stuart.
 
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: 61
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
salasi
Senior Member
 
Registered: Jul 2007
Location: Directly above centre of the earth, UK
Distribution: SuSE, plus some hopping
Posts: 4,070

Rep: Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897
Quote:
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
mikey99
Member
 
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.

Mike.

Last edited by mikey99; 11-27-2008 at 11:27 AM.
 
Old 11-28-2008, 03:35 AM   #5
wificraig
Member
 
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
undoIT
Member
 
Registered: Jan 2009
Distribution: Fedora, Ubuntu, Mint, Sabayon
Posts: 35

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
 
Old 11-30-2014, 01:34 AM   #7
nileshkumar
LQ Newbie
 
Registered: Nov 2007
Posts: 21

Rep: Reputation: 0
Quote:
Originally Posted by undoIT View Post
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.
@undoIT can you please explain what do you mean for "The first primary partition is for grub", is it the /boot partition or something else, as I am planning to install the same way you have done.
 
Old 11-30-2014, 01:40 AM   #8
undoIT
Member
 
Registered: Jan 2009
Distribution: Fedora, Ubuntu, Mint, Sabayon
Posts: 35

Rep: Reputation: 15
Yes, the first partition was /boot. But, it has been a long time since I did this and things may have changed a bit since then.
 
Old 11-30-2014, 08:04 PM   #9
EDDY1
LQ Addict
 
Registered: Mar 2010
Location: Oakland,Ca
Distribution: wins7, Debian wheezy
Posts: 6,841

Rep: Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649
Quote:
Originally Posted by nileshkumar View Post
@undoIT can you please explain what do you mean for "The first primary partition is for grub", is it the /boot partition or something else, as I am planning to install the same way you have done.
If you plan on putting multiple distro's you may be limited as to how many OS you can put on drive.
Some of the limiting factors:
Sata hdd's if MBR are limited to 15 partitions.
Ide 63
GPT 128
 
Old 12-01-2014, 03:02 PM   #10
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,980

Rep: Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624
2008 post.
 
Old 12-02-2014, 07:17 PM   #11
Lsatenstein
Member
 
Registered: Jul 2005
Location: Montreal Canada
Distribution: Fedora 31and Tumbleweed) Gnome versions
Posts: 311
Blog Entries: 1

Rep: Reputation: 59
Quote:
Originally Posted by Stuart Morrow View Post
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,
Stuart.
No! The hybernate information is stored in thw swap file, and the contents therein include information about what was running where in memory at that moment.

The 2nd system knos not about the first, and will clobber the swap file contents
 
  


Reply

Tags
hibernation, sharing, suspend, swap



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 / openSUSE 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

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 07:04 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