LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Could another distro mess an hibernated linux? (https://www.linuxquestions.org/questions/linux-newbie-8/could-another-distro-mess-an-hibernated-linux-766001/)

Fenchurch 11-01-2009 09:20 AM

Could another distro mess an hibernated linux?
 
Hello, I have a simple linux question. I think I could test it on a virtual machine if I weren't too lazy to procrastinate, but I'll ask it here.

Ok, so you have two different distributions installed on the same disk sharing a swap partition. You start one and hibernate it. Then you would have important information stored on the swap, right?

If you start the other distribution, it could cause some problems on the swap partition, making it harder for the fist one to restart. Or would it work fine? Is it safe to do that?

And how dangerous would be to mount an hibernated windows partition on linux?

r3sistance 11-01-2009 10:08 AM

I am not certain of this, but I am fairly sure that the swap partition won't be mountable by the second distribution as the resource will already be considered in use by the first, I suspect you'd also see the same with the hibernated windows partition, as the device is already in use by something else the distribution would be unable to mount it. However if it is possible it could cause multiple issues... as you could effectively change some of the enviromental settings or overwrite some enviromental settings that could really cause anything to happen.

GrapefruiTgirl 11-01-2009 10:23 AM

I will leave it to someone else to address the Windows angle, as required, but for the Linux situation:

Two distros sharing a swap space, is no problem, provided it is ONLY a swap space, and not THE swap space that will be used for hibernation.
To ensure there are no problems with multiple distros messing with each others HIBERNATION SWAP space, make sure that:

1) swap-only swap space(s) should be marked "auto" in the fstab file.
2) hibernation swap spaces should be marked "noauto" in fstab.
3) If multiple distros will be wanting to hibernate to a swap space, be sure to define each respective distro's hibernation swap space in the LILO or GRUB configuration, using the "resume=/dev/XXX" appendage to the respective kernel boot line for that distros kernel, where XXX is the swap partition you want to be used.

Each distro, AFAIK, has no idea that a given swap space is occupied by a hibernated distro, so mounting it with another distro is asking for trouble, because if it gets used as a regular swap space by any means, it will probably screw up the hibernated image, making it not only harder but probably impossible to resume successfully. NOTE: Maybe one can mount a swap space RO (read-only) but I'm not sure? I don't know why you might want to do this, but check the man page for 'mount' or 'fstab' to see if you could mount a swap space read-only.

A Windows related guess: I think Win uses a swap "file" rather than a partition. Besides this (if correct) much of the same above Linux stuff, probably applies to Windows too. But, if let's say two Win OS's are on one machine, and you suspend one of them, if it suspends to a FILE, there's probably nothing to worry about when booting and suspending the other OS's, and subsequently suspending THAT one, as it would suspend to its OWN file, on its OWN partition. Again, this is just speculation-- I don't use Windows.

Hope this helps!

Sasha

Wim Sturkenboom 11-01-2009 10:27 AM

I have always assumed that the running OS assumes to have a swap for itself. So after a hibernate, another OS can do whatever it wants with the swap (if it's shared).

Windows does not have a swap partition (at least not the last time I looked which is before XP) but a swap file. So I don't think it's dangerous to mount. And to read. Writing to a file that was open might be another issue.

Please post your experiences. Your question so you can take the risk :)

Fenchurch 11-01-2009 11:06 AM

Quote:

Originally Posted by GrapefruiTgirl (Post 3740146)
Two distros sharing a swap space, is no problem, provided it is ONLY a swap space, and not THE swap space that will be used for hibernation.

So the only way to be safe would be to have a swap partition for each distribution?
I have Linux Mint and was planning to add a slackware, but it looks like I'll need to repartition again.
I also have two ntfs partitions, one has windows vista installed and the other one is just data. If I leave windows hibernated and try to mount the data on linux it brings me an alert, I could force mount but don't want to risk.
BTW thanx for the help

w1k0 11-01-2009 11:16 AM

On short: you could hibernate as many distributions as you like and run in the meantime other distributions assuming that each your distribution uses the separate swap partition. If your machine has 1 GB of RAM or more use swap partitions of the same size as your memory.

GrapefruiTgirl 11-01-2009 12:02 PM

Quote:

Originally Posted by Fenchurch (Post 3740187)
So the only way to be safe would be to have a swap partition for each distribution?

You can use the same swap space for any number of distros, as log as it's only a SWAP space, for swapping ONLY. On top of that swap-only space (I mean, in addition to it) you would want to have a "noauto" swap space for hibernation of that distro.
So: If you have 3 Linuxes, and you will want to hibernate all 3 of them safely, but share a swap space for swapping, you would want a total of 4 swap spaces; one for swapping, and one EACH to hibernate each Linux.
Quote:

...

I also have two ntfs partitions, one has windows vista installed and the other one is just data. If I leave windows hibernated and try to mount the data on linux it brings me an alert, I could force mount but don't want to risk.
BTW thanx for the help
As for the bold section above, you'd have to give exact text of the warning or message(s) for me or someone else to make a determination of what the alert means, and what implications might be there if you were to force a mount. Maybe Linux is just clever enough to be warning you that what you're trying to mount, IS a hibernated image, and advising against it. However, even in this case, you *should* be able to mount it read-only, and be safe.
Then again, *why* would you want to mount a Windows hibernation image, from Linux?

Also, as noted above by me and other(s) members, Windows should be suspending to a file, not a partition, so is it a file or a partition that you are trying to read or mount? I just want to be sure we're talking about the same thing here.


Sasha


All times are GMT -5. The time now is 07:35 PM.