1.

Solve : Tweaking Hibernation Functionality for slower laptop to boot faster?

Answer»

I was thinking that maybe one way to speed up a Pentium 3 laptop with 512MB RAM would be to perform the following:

- Enable Hibernation
- Tell system to Hibernate ( system is shut down at this state )
- Boot laptop off of Linux Distro which will allow me to modify the hard drive without it wanting to come back to life from windows hibernation boot.
- Make a copy of the HIBERFIL.SYS file ( The RAM dump/load File ) and save this to say C:\RAM_IMAGE\
- Edit Autoexec.bat to copy HIBERFIL.SYS from C:\RAM_IMAGE\ to root of C:\   (512MB will copy fast local disk/disk on 80GB Hard Drive )
- Shutdown Linux Live Distro and boot laptop normally

*Assuming laptop will boot out of hibernated saved state injecting RAM with RAM Image HIBERFIL.SYS file as normal and boot time to desktop usability is faster, since the assemble process from disk to memory, and services started etc are just injected as the last saved state, which would now become the persistent faster boot state.

I haven't done this yet, but figured I'd run this past everyone for any suggestions, concerns, and input etc on tweaking hibernation this way?

To me thinking about it it seems dirt simple and should work. Biggest unknown I can think of is how long it will take for the RAM Image file to copy from local disk C:\RAM_IMAGE\ to the root of C:\ where Windows then looks for saved state after this file has been copied there and if found boot using this saved state injecting RAM from RAM dump.

Read some information online that some people state this can lead to drive corruption etc, loss of data etc, but I cant see how it could cause drive corruption or dataloss loading from RAM Image using Hibernation Mode for a faster boot to a single persistent boot state. Your data is not stored in this image, and the image does not span the contents of the entire drive to where its always going to boot to old state and wipe out anything new. If anything new was created you can simply navigate to it and open up new content using the old system state ram injected boot. This way no matter how the system was shut down, it would now always boot off the old image that should be good for multiple boots vs just a single boot and rewrite every time hibernation is used if used the way that Microsoft intended for it to be used. Quote from: DaveLembke on March 02, 2013, 02:35:28 PM

Read some information online that some people state this can lead to drive corruption etc, loss of data etc, but I cant see how it could cause drive corruption or dataloss loading from RAM Image using Hibernation Mode for a faster boot to a single persistent boot state. Your data is not stored in this image, and the image does not span the contents of the entire drive to where its always going to boot to old state and wipe out anything new. If anything new was created you can simply navigate to it and open up new content using the old system state ram injected boot. This way no matter how the system was shut down, it would now always boot off the old image that should be good for multiple boots vs just a single boot and rewrite every time hibernation is used if used the way that Microsoft intended for it to be used.

That's somewhat true and I understand what you're trying to do, however:
Let's say you have programs running (system processes and explorer.exe in particular are open a lot) that have open file locks or counters or some other situation like this (and there are many other situations where this will be a problem). If the disk doesn't match what the OS thinks it should be, that's a problem.

I'll use a made-up program i "wrote" as an example.
I log my program's activity continually. Every hour or when the current log reaches a certain size limit, I increment the number of the log file to save to. I keep track of the current log file in memory.
Normally, it will run fine, every hour create a new log, maybe CLEAN up old logs, whatever. Let's say I'm at log number 36.

Now I hibernate and resume later. No big deal, I'm prepared for occasional I/O errors. I create logs 37, 38, 39, 40.

Now I resume that same state again (still log 36). This is where the problem happens. I'll start overwriting past log files (which, according to the saved program state, shouldn't even exist yet). Logs 37-40 still exist on the hard disk. when I need to go to log 37, it already exists. What should I do? Overwrite it? Append to it? find the next free log file? The real problem isn't what to do in this situation, the problem is that the program traveled 'back' through time by re-resuming an old hibernation file. This should NEVER happen in normal circumstances.

This is just one example (and a relatively simple and harmless one at that) of how screwed up things can get. Now imagine something similar happening to the OS. File system operations, disk files mapped or buffered in memory that are currently being read, etc. etc.

Now, if I was Microsoft, I'd probably think of this at some point. Certainly by now, it's been almost 14 years since hibernation support was around. I think it would be a glaringly obvious bug to let hibernation continue with a different disk state from when the hibernation file was saved, and I'm going to read my Windows 2000 internals book right now to check if anything is in there about it.

EDIT: I noticed this in your original post
Quote from: DaveLembke on March 02, 2013, 02:35:28 PM
- Edit Autoexec.bat to copy HIBERFIL.SYS from C:\RAM_IMAGE\ to root of C:\   (512MB will copy fast local disk/disk on 80GB Hard Drive )
Unless I'm very, very wrong about this, the NT family only performs parsing of environment variables in autoexec.bat. This means you can't RELIABLY do anything else with the file. Furthermore, I would guess the parsing wouldn't even be done when resuming from hibernate anyway, more or less defeating the purpose of this exercise.Not saying it will produce the results you are after or not...BTW good luck with the experiment and let us know.
That being said i've never been a big fan of any Windows power-saving features...and usually just disable all of them.
Other thing to consider with a laptop is the same settings in the BIOS as well as some of those are set so the manuf. can brag about battery time...to run a true test i'd disable any/all of those as well.
The only other thing i would point out...and i'm no expert in this is that hiberfil.sys is re-created each boot...so i dont see how the nanoseconds that takes would actually speed things up having it in place...however i could be wrong on this...someone such as BC who programs may be able to clarify that.

All that stated i'll go back to my standard issue thought on boot times which has always been boot up is when you go to make coffee...but it'll be interesting to see your results. Quote
Now, if I was Microsoft, I'd probably think of this at some point. Certainly by now, it's been almost 14 years since hibernation support was around. I think it would be a glaringly obvious bug to let hibernation continue with a different disk state from when the hibernation file was saved, and I'm going to read my Windows 2000 internals book right now to check if anything is in there about it.
I was thinking about this too, but thought why would they test for this since the HIBERFIL.SYS file is burned by the OS after use and overwritten with the next hibernation. That is the reason for why keeping the copy of this at C:\RAM_IMAGE\ and repopulating the root of C:\ would be necessary. I am almost thinking that the cleanup process after the system is fully online from its image injection state, it then burns this file to not use it again, (but this has not been confirmed yet and is an assumption that I am going to dig into when I get home from work).

I see what you mean about fopen etc being an issue etc with files that would change etc, and just thought I wonder how it would behave if say the system went through an update, such as IE is updated from 7 to 8 etc. Even if the system was hibernated from a completely clean as possible state, nothing running but the desktop and services etc, I suppose mismatches could occur down the road if the systems OS and Software components are updated with the Hibernation Ram Image being past information. *Maybe this can be fixed by simply shutting off auto-updates and running the system with no further software updates example being Adobe, Java, etc.

Interested in if you find any info in the Win 2000 Internals on this. Programmers usually harden their products, but if they are only expected to function within the rules set by the environment, which should never change, that is when it makes it easy to bend the functionality of the original intent and possibly perform what I am thinking at this point may be fine for a system that wont take any updates automatically and if updates are needed. Kill the autoexec.bat process instruction to plant the HIBERFIL.SYS file and boot normal, update system to latest. Then hibernate the system and boot again to Linux to update C:\RAM_IMAGE\ with the latest persistent hibernation image to boot off of. Then edit autoexec.bat to make this active again and be running patched/updated.

See this: http://mydefrag.com/Manual-KnownProblems.html (at the bottom). I wish I could find more evidence of that, but that's the only big warning I remember off the top of my head.

From the point of the OS, it would be like the disk was modified between hibernation and resume (which in this case would be true). That's a really bad situation for any programmer to deal with really, especially with things like filesystem drivers.

Unfortunately, I couldn't find anything in the 2000 internals book about hibernation (it's not even in the index) other than the fact that it exists as a system power state and that hibernation is done by the power manager and resume is done by ntldr.

Quote from: patio on March 02, 2013, 03:28:48 PM
All that stated i'll go back to my standard issue thought on boot times which has always been boot up is when you go to make coffee...but it'll be interesting to see your results.
Agreed, it's better to just shorten bootup other ways (I use r2 Studios Startup Delayer) and at some point just go away while the PC boots. You'd be surprised how much faster it seems to start.

You can go ahead and try it, but I'd have backups of all your data in case it corrupts the disk. But as my edit in my first post says (not sure if you got to read it or not) AUTOEXEC.bat will likely not work to copy the hibernation image anyway, so you'll have to play with it.

Personally, I've never actually had a problem with sleep or hibernation in Windows XP or 7 (don't remember using it 2k, avoided Vista, 98 was absolutely terrible), and I don't know why you'd need to resume from the same image every time at all.I'd like also to see the source that stated that file corruption/ data loss is possible in this...That would be a good read as they have spent bunches of time supposedly testing this...
I think what they may be saying is the 1st 3 times they did it the results were less than what they expected.I looked on the BartPE forums and did some searching for hibernation. It's not a completely unknown problem and actually makes a lot of sense: If you suspend the file system driver, change data on the disk, and resume the file system driver, the file system driver still has some amount of information stored about the OLD disk (like possibly locations and sizes of filesystem transaction logs). If it deals with corrupted logs or entries by deleting them or ignoring them (or not knowing at all and acting as if it was the same as the old disk), you could effectively be using the old disk's filesystem tables or transaction logs with new data on the disk. That's bad for what I hope are pretty obvious reasons.

I also found this: http://superuser.com/questions/39532/hibernating-and-booting-into-another-os-will-my-filesystems-be-corrupted

It seems that some people have problems sometimes, others don't other times. Basically what I got out of it is "It may not be obvious when you have or haven't lost data, so it's best to avoid the situation altogether"Make that coffee...
I told you guys you're better at this than me. Quote from: patio on March 02, 2013, 03:28:48 PM
...
That being said i've never been a big fan of any Windows power-saving features...and usually just disable all of them.
...
My 1-year old Win7-64 bit will not come out of hibernation.  Standby works, but Hibernate must be removed or it will go to Hibernate instead of Standby.  My laptop's HDD is 7200rpm & boots less than a minute from pressing the power switch & logging on.

If you want to boot fast, get an SSD, but probably not available for a PIII which is likely ATA/IDE.  Get a faster hard drive, i.e. 5400rpm instead of 4200rpm.  It makes a huge difference, just did some drive installs yesterday on an old PII.First off... thanks everyone for taking the time to look this idea I had over and pick at it for problems!

Maybe it was a good thing that I got bypassed from going through with this, having to play plumber instead in my kitchen with a problem that killed my dishwasher. Long story short... I should have had a water filter in line before dishwasher installation 8 years ago and didnt, and small rocks and sand in well water did a good job restricting and then killing dishwasher. Problem now solved, and my wife is happy with new dishwasher, so I can get back to projects that are more enjoyable.

Looking at the R2 Studios Startup Delayer, that TechnoGeek suggested, this actually looks like the best solution than what I was going to attempt, as well as boot up's would be faster not having to perform a disk-to-same-disk hibernation image copy prior to every windows xp boot.

The startup CPU 100% UTILIZATION bottleneck of everything wanting to start up.... being able to delay services etc that are not needed right away such as mySQL server service, and other services should definately make a difference. So I am going to try this out tonight.

Just as this states from link below, this is what i am looking for:

Quote
BOTTLENECK!

Have you ever wanted to just turn on your computer and check your email, or Google something real quick and then shut off? Maybe you want to spend 3-5 minutes on your computer to look at something, or find an answer, but your computer takes 3-5 minutes to even become useable because it is Soooo Slooow when it STARTS up. Maybe you want to be on your computer all day, but you would just like to be able to use it in less 10 HOURS OF TURNING IT ON!!!

Wouldn’t it be good if you could tell ALL of those other offending programs and services to wait a while before they do their business? Maybe even stagger them so instead of them all trying to start up at once, they do it one at a time in an orderly manner?…………Now your getting it!

Go check this program out – You NEED this! R2 Studios Startup Delayer.

The free version will do pretty much everything you want, but I will be buying the pro version anyway (only $20) because I believe these people deserve a little something for their efforts, it really is a great piece of software!

Thank You for pointing me into this direction TechnoGeek! And I will probably buy it for $20 if its that good!

http://www.thewebernets.com/2011/08/19/r2-studios-startup-delayer-for-windows/

As Computer_Commando suggested:
Quote
Get a faster hard drive, i.e. 5400rpm instead of 4200rpm.  It makes a huge difference, just did some drive installs yesterday on an old PII.

*Well the 80GB IDE in it that replaced the original 12GB is 5400rpm's. The older original 12GB was probably 4200rpm's. I Did see a performance gain 4 years ago when installing the 80GB out of a dead Pentium M laptop that had a busted display and motherboard issues.


Below is just current specs of laptop and prior specs .... figured I'd add this here in case you didnt want to look over the before and after info and where parts came from etc.

Current specs are:   (*Not much more can be upgraded on this)

- Pentium III 600Mhz
- Maximum Supported RAM = 512MB SDRAM 133Mhz running backwards compatability as 100Mhz FSB (just recently upgraded from 384MB to 512MB thanks to help here suggesting PC133's work most of the time in place of PC100 sticks.)

- 80GB IDE HDD       ( out of a newer Toshiba that was dead, but healthy HDD )

- DVD/CD-RW Drive ( out of a newer Latitude Dell that is of same case/optical IDE drive slot design newer guts, dead but drive good. Original drive was only a CD Rom)

- Broadcom 10/100 NIC ( out of another computer that I put in place of the original 56k or 33.6k modem ) * This laptop had a plastic insert blocking the RJ-45 slot. Laptop was designed for NIC upgrade and/or a more expensive model version of the time would have had the NIC without the plastic plug blocking the RJ45 slot. I removed the plastic insert from RJ-45 slot which could only be removed with the laptop case open and removed from the inside, and plugged NIC ribbon cable into the Broadcom 10/100NIC that came out of a IBM Thinkpad that was stripped of working guts, and installed into this Dell.

-Windows XP Pro SP3

-------------------------------------------------------------------------------------------------------------

Original specs when I got this laptop for free from a client looking for a proper disposal/recycle of it vs throwing it in with regular trash was:

Pentium III 600Mhz
128MB SDRAM PC100
12GB HDD IDE
24x CD-ROM
33.6k or 56k modem
Windows 98SE

But, I saw no point in destroying and recycling the parts of this perfectly fine running laptop, and decided to keep it as a beater laptop and perform upgrades to it as parts were available free from other dead systems or inexpensively. I think I only have $120 tied into it, the Windows XP OS costing me $100 and the RAM was $20.As others have stated, this is a bad idea for a number of reasons. File system drivers will have structures that refer to clusters and sectors on the disk who's data has been moved elsewhere; internal structures referring to currently open files will no longer point to the same place. Imagine if you froze the system state, and defragmented the hard drive. pretty much none of the data referring to files- including the registry hives- will still be valid. If I had to guess I'd say the best case scenario is that this would cause a REGISTRY_ERROR BSOD at best. PFN_LIST_CORRUPT, or more likely a BSOD in one of the Filesystem Drivers.


Best of all: even if it works, if you then write files to the disk, it will quite likely cause the filesystem to become unreadable if you write any files at all.


Discussion

No Comment Found