Ubuntu QA:
BlogBrainstormPackage status
Log in
Ubuntu QA
The Ubuntu community has contributed 21986 ideas, 135057 comments, 2615221 votes
Idea sandbox Idea sandbox
Popular ideas Popular ideas
Ideas in development Ideas in development
Implemented ideas Implemented ideas
Idea #8092: Use file for hibernation instead of swap partition

Written by ethana2 the 5 May 08 at 08:27. Category: System. Related project: Nothing/Others. Status: New
Rationale
Use case: A person, let's call him Ethan, has Fedora, Ubuntu Hardy, and Ubuntu Intrepid installed on a new Dell laptop.
He confuses his swap partitions. He keep losing his hibernated sessions which he sometimes entrusts with unsaved data, and he doesn't really understand why.

Data specific to one operating system should not be stored in a swap partition when said operating system is not active. A swap partition may be best for use as swap space, but when a system is hibernated, that information needs to be stored in a file within the root partition of the operating system instance that is hibernating.

Only one swap partition should be needed on a multi-boot system.
Tags: Hibernation

48
votes
up equal down
Solution #1: Auto-generated solution of idea #8092
Written by ethana2 the 5 May 08 at 08:27.
Ubuntu Brainstorm was updated in January 2009. Since the idea #8092 was submitted before this update, its rationale and solution are not separated. Please vote accordingly, and if you have the necessary rights, please separate the rationale from the solution. Thanks!

Propose your solution

Attachments
spec Blueprint foundations-karmic-swapfile: [Information on this blueprint will be retrieved soon]


Duplicates


Comments
zooounds wrote on the 5 May 08 at 10:06
Different OS instalaltions should never share swap -1

steve196 wrote on the 5 May 08 at 11:41
I did not know that.
Logically you would think, that whatever is on the swap partition is junk after the OS quits and can be overwritten without damaging anything. If it isn't so, that is unexpected behaviour.
+1

pitwalker@gmail.com wrote on the 5 May 08 at 12:14
Hibernation is good when only 1 OS in the machine.
(Or when you hibernate you must start with hibernated OS!)

siegie wrote on the 5 May 08 at 16:38
Not all people have enough space on their root file system.
Most people have only one OS, so i think default we should hibernate to swap.

livio wrote on the 5 May 08 at 18:58
This is a rare situation when a person have more than one Linux based operating system in his computer, and I can“t imagine this situation on a notebook, where hibernate is more used.

-1

ethana2 wrote on the 5 May 08 at 19:57
Alright, let's explore another scenario.

A teething power user has Windows XP, Ubuntu Hardy, and Ubuntu Intrepid installed on his machine. Because he thinks that swap is basically just extended RAM, his Ubuntu installs share a swap partition. All he knows is that XP can hibernate reliably, and Ubuntu cannot. He figures it must be a hardware driver problem, and files a bug against HAL and the kernel. He now feels 1337, but his trust of Ubuntu is wounded, and he continues to rely primarily on his XP install.
..and the kernel and HAL folks have random, useless bugs to triage.

You can't say that I'm not human just because I'm more technically inclined.

"Swap is virtual RAM." ---It should be that simple.

ethana2 wrote on the 5 May 08 at 19:59
A kid has 1 GB of RAM and 1 GB of swap. He has the GIMP open working on some things, and is using 1.3 GB of his total virtual memory. He goes to hibernate and it fails miserably. Would you like to explain to him why?
---because he doesn't /care/.

ethana2 wrote on the 5 May 08 at 20:05
Please remember folks that you can't label a swap partition. It's just linux_swap. That's it. It was recommended to me recently that I keep track of my partition table on paper. In my opinion, that's ridiculous.
(I'll try not to comment here again for a while...)

ethana2 wrote on the 18 May 08 at 08:51
Ok folks, this isn't funny anymore.

Modified i-RAM module, 2 GB DDR mobile SATA form in Sony PlayStation 3.

That memory /will/ be blank when the power gets pulled, and I don't want my hibernated sessions going with it.

ethana2 wrote on the 25 May 08 at 03:22
Jucato tells me it already works like this..
but I don't know for sure.

NigelCunningham wrote on the 28 May 08 at 04:34
Recent swsusp (and uswsusp?) support hibernating to a swap file. TuxOnIce also supports hibernating to an ordinary (ie non-swap) file.

ethana2 wrote on the 12 Oct 08 at 04:26
2.6.27 evidently supports hibernating directly with initrd.gz or something..

Auzy wrote on the 12 Oct 08 at 04:29
Actually, one strong reasomn for supporting this would be eeepc. Some only have a 8GB hdd, so nobody would want to put permanent space aside for a partition thats only for swap. If a file was used, it could be adjusted in size easily, and allow space to be more efficiently

gnc wrote on the 14 Dec 08 at 00:37

Regarding swapping IMHO users should be able to choose at install time between swap file, swap partition or swapless system.

Regarding hibernation IMHO users should be able to choose between swap file, swap partition or a regular file.

BenHocking wrote on the 16 Apr 09 at 13:50
I agree with gnc.
In some situations you may want the file on the swap, but in most you would not. e.g. most computers you buy off the shelve today have 2gb of ram. So if i want to hibernat with half of that i need 1gb free in the swap, so my swap needs to be around 1.7gb for it to work almost all the time. given that the swap is already filled with a few hunderid mb of data.

I currently have this problem atm. 1.5gb of ram. yet a 1gb swap file and around half of my ram is in use. Now it is a hell of a lot easier to move some files of my main parititon and onto another. Or to deleate some un-needed stuff than it is to resize my swap partition to take up 1.7gb. That's 700mb of un-avaliable and written off space that the computer won't use most of the time.

End result. For most home users who use ram intensive applications or those using notbooks (as stated earier by Aucy) having the hib data on the swap is counter productive and a far less efficient use of disk space.

For others maby not so.

Solution:
just give people the choice. When instaling the Os just have a screen, would you like hib data to go to swap or main partition with a small bit of help text.

p.s. sorry for spelling mistakes.

lavinog wrote on the 1 Jun 09 at 23:05
Is this implemented already or not?
How do we find out how hibernation works?

mishaokami wrote on the 7 Aug 09 at 09:23
another case:

I had and old system with 1gb ram. 1gb swap was fine to hibernate to.

Just upgraded to 4gb. Now i can't hibernate anymore because swap partitions aren't flexible enough. And before you tell me to use gparted to resize partitions understand that that is an unworkable solution for a normal user and many partition types are still not fully supported.

cong06 wrote on the 12 Jan 10 at 15:41
Auzy has a point.
With eeepc's I refuse to dedicate a whole GB partition just because my laptop uses a GB of ram.
Also, is there any reason that the "hibernating" file can't be flexible? That way if I only need 300MB of space, it'll only use that much.

lavinog wrote on the 9 Feb 10 at 19:47
"Also, is there any reason that the "hibernating" file can't be flexible? That way if I only need 300MB of space, it'll only use that much. "
I don't see why not. Have the system clear the buffers and cache prior to hibernation. Loading a 300M file should be much quicker than a 4Gb file.

ZacK.YoveL wrote on the 8 Jun 10 at 11:12
Actually I do see a reason why to specify (manually or automatically) a minimum size for that swap file.
assume you have 1 gb ram (I have 3, most have not less than 2) and you are currently using only 3 gb of swap. Now your disk is almost full, and since you only use 300 mb ram, your system saves your work so that you don't have any more space left for the swap. You try to hibernate the system, but there is no space to save your 1 gb of ram.
This applies on any "flexible" method of using swap, simply because if you used a small amount of swap, and used other space for permanent files, you got less space for swap now.
A file is a good idea though when considering a situation of lot's of free space on the disc (probably the more common situation in new machines) and thus your swap file can extend itself more than it's minimum size if you need it to, during your work, or if you need more space for hibernation than your minimum space. Still, if your disc is full, you'll only have your minimum reserved space for the swap file so it must be large enough.

ZacK.YoveL wrote on the 8 Jun 10 at 14:21
There is another advantage for using a swap file - it can be much easier to resize it when installing more ram.

charlieb000 wrote on the 15 Mar 11 at 05:42
GRR, the ubuntu setup should have said that i needed a swap file the size of my ram FOR HYBERNATION.... neither do i know how i am managing to use almost 1010MB of ram in my short session, so i will add that the hybernating function should only save the necessary stuff, that way i only need a small hybernateing file.

Charlie.


Post your comment