| Linux - Kernel This forum is for all discussion relating to the Linux kernel. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
08-17-2012, 03:42 AM
|
#1
|
|
LQ Newbie
Registered: Aug 2012
Posts: 17
Rep: 
|
Hibernate-Snapshot device
I would like to know how the snapshot of the system is taken during hibernation(S2disk) which is then stored in the swap partition.A typical /etc/suspend.conf shows that the snapshot device to be used is set to /dev/snapshot. Please suggest something to make my understanding better as to how the snaphot image is created and exactly how it is stored at its position which is then loaded into memory on resume(resume device parameter embedded into initramfs).
|
|
|
|
08-18-2012, 02:13 PM
|
#2
|
|
Guru
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 5,294
|
As I understand it, the system at any point has a kernel running and stuff loaded in relevant spots. By putting these things back in memory exactly as they were and telling everything where to take up, you _should_ be back to where you were before the suspend.
In fact it never works as cleanly as that(Murphy's Law), and there's 'glue software' to fix that.
|
|
|
|
08-18-2012, 11:27 PM
|
#3
|
|
LQ Newbie
Registered: Aug 2012
Posts: 17
Original Poster
Rep: 
|
Thanks for the reply.
As you explained,the contents of RAM as they were before suspend are stored in swap and on resume the kernel loads them into memory again on resume to give us a feeling of a new kernel being loaded and resume to the state as we suspended in.
My question is how exactly is this snapshot taken and saved into the swap partition? And at what point during boot is this image loaded into the memory?
|
|
|
|
08-20-2012, 03:49 AM
|
#4
|
|
Guru
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 5,294
|
Quote:
Originally Posted by linkaran
Thanks for the reply.
As you explained,the contents of RAM as they were before suspend are stored in swap and on resume the kernel loads them into memory again on resume to give us a feeling of a new kernel being loaded and resume to the state as we suspended in.
My question is how exactly is this snapshot taken and saved into the swap partition? And at what point during boot is this image loaded into the memory?
|
Isn't this the beauty os Open Source, that you can look at the code for yourself and figure these things out? I never bothered, once it worked. If you boot, suspend, & resume then the dmesg output carries a blow by blow as it unhooks usb, etc.
If you tell us why you need this information, we may be able to help.
|
|
|
|
08-21-2012, 02:40 AM
|
#5
|
|
LQ Newbie
Registered: Aug 2012
Posts: 17
Original Poster
Rep: 
|
Thanks for the reply.
Well my long goal is to achieve a kind of hybrid between hibernation and shutdown where I close all the user-space program before powering down the system and also create a hibernation image. We use this image to the boot the system.
I am in the initial stage of learning the mechanism of S2disk and studying the role played by pm-utils,ACPI and initramfs.Right now I am trying to locate the process/code responsible for the creation of image and storing it in the swap.I hope this gives a broad idea of the work.
|
|
|
|
08-21-2012, 03:37 AM
|
#6
|
|
Guru
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 5,294
|
To quote the Irishman when asked for directions:
"If I was you, I wouldn't start from here at all!"
Suspend and resume are major deals requiring balancing of all sorts of things. They were developed over years by project teams. For instance, the original APM implementation couldn't effectively handle IBM Thinkpads, which broke a number of expected norms and created havoc with interrupts. So it was dropped, and a whole new approach (acpi) was started, which initially was worse on many boxes.
You don't need a suspend, or hibernate. You want switch off,and autostart, and something like initng which boots and shuts down quicker. The beauty of suspend and hibernate is that you stay there with your same lusers logged into the same places, same programs running, reading same files, with environment variables intact, etc. This is behaviour you do not want.
|
|
|
|
08-21-2012, 08:05 PM
|
#7
|
|
Senior Member
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian Testing; OpenSuSE 12.1; Fedora 17
Posts: 1,541
Rep: 
|
Suspend and hibernate are hardware dependent. Programs designed to implement an interface between the operating system and hardware facilities for suspend/hibernate must comply to the relevant hardware, because it is the basis of those functions.
Neither is designed to boot a cold system. Hibernate begins to load the system image by a makeshift init linked to /sbin/init, in a conditional way, so if it fails, the system is recoverable.
Of course, it doesn't work that way, but that's the goal.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 08:11 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|