Go Back   Notebook Forums and Laptop Discussion > Hardware, Software and Accessories > Windows OS and Software > Microsoft Windows 7

Microsoft Windows 7 Discuss the new Microsoft Windows 7 related topics here

Welcome to NotebookReview.com! Have a Laptop related question?

Register and ask it here in the forums and remove this ad

Are you looking for a Lenovo laptop or special offers? Check out our Why Buy Lenovo? page

Reply
 
Thread Tools
Old 10-29-2009, 01:14 AM   #1
ScuderiaConchiglia
NBR Vaio Team Curmudgeon
 
Join Date: Jun 2007
Posts: 4,625
Rep Power: 25 ScuderiaConchiglia has much to be proud ofScuderiaConchiglia has much to be proud ofScuderiaConchiglia has much to be proud ofScuderiaConchiglia has much to be proud ofScuderiaConchiglia has much to be proud ofScuderiaConchiglia has much to be proud ofScuderiaConchiglia has much to be proud ofScuderiaConchiglia has much to be proud ofScuderiaConchiglia has much to be proud ofScuderiaConchiglia has much to be proud ofScuderiaConchiglia has much to be proud of
Default Defragmenting boot files under Win7

Some time ago I wrote an article here exposing the Tune XP tool's supposed magic for defraging the OS boot files. I found what it did and wrote a method for Vista users to do this boot file defrag themselves.

Since I just converted to Win7, I was anxious to see how my method worked with Win7. I am happy to report it works well, and in fact under Win7 it is much more illuminating as to what is happening. Follow along below for details.

First some background info. Win7 and Vista both have an automated process for defragging the boot files. However, under Vista (not sure about Win7 yet) many laptop users never have this automated process kick in. Why? Because the process is designed to start only if the machine is left idle for a period of time. Most laptops are not left idle long enough for the process to trigger, hence the need for a manual way to force the defrag.

Attached to this post is a file named DefragBootFiles.ZIP. (This is EXACTLY the same file that appeared in my post about defragging Vista boot files.) It contains a batch file with two lines:
Code:
Rundll32.exe advapi32.dll,ProcessIdleTasks
defrag -b %SystemDrive%
(If you choose to create your own file DO NOT NAME IT DEFRAG.BAT! If you do it will cause the batch file to loop over and over!)

Open the zip file and move the batch file file to your desktop. Close ALL running applications.

Then right click on it and select run as administrator. The first line just tells Win7 that all applications are idle and it can start a background task that is just sitting there waiting for this event to occur. That task analyzes the boot file history that Win7 maintains and creates a file with the optimum order for these files. The second line starts a specialized defrag process that uses that ordering information and puts these boot files into the proper sequence!

When you run the batch file it will popup a command window and looks like it is just sitting there hung on the first line. It's not, trust me. Read on...

If you open Task Manager and view all running processes, the two processes (Defrag and DfrgNTFS) that showed up when we did this under Vista, no longer show up. Instead there is a service that does. In Task Manager if you switch to the Services tab and sort by name you will see defragsvc running. This is a service that is always loaded under Win7 but remains stopped until needed. The line in the batch that forces the idle tasks to start will wake up this service. If you switch to the Performance tab in Task Manager and click the Resource Monitor button, you can then click in the check box to the left of “svchost.exe(defragsvc)" and then open the disk IO segment of the resource monitor. There you can see just the IO that the defragsvc is doing. Also the CPU and DISKIO graphs will then have an additional orange trace just for the stuff the defragsvc is doing. Check this out:



Even cooler, the defrag command in the batch file now has some output. (For those of you who used my batch file under Vista you'll remember that the command window never showed ANYTHING.) If you watch the command window where the batch file is running, when the batch file gets to the second line (and this can take a few minutes as the first line in the batch file takes a while to execute) you will see:

Code:
C:\Windows\system32>defrag -b C:
Microsoft Disk Defragmenter
Copyright (c) 2007 Microsoft Corp.

Invoking boot optimization on (C:)...

Pre-Defragmentation Report:

        Volume Information:
                Volume size                 = 49.99 GB
                Free space                  = 21.12 GB
                Total fragmented space      = 2%
                Largest free space size     = 4.59 GB

        Note: File fragments larger than 64MB are not included in the fragmentation statistics.
When the two lines in the batch file are done the command window will disappear.

Now some IMPORTANT words of caution: Be patient, give it some time. It can take anywhere from a few seconds to an hour even. Just depends on how fragmented your files are. I just ran it and it took about seven minutes. Your disk drive light will show LOTS of activity.

Sit back, have a cup of coffee or whatever. Just wait until the command window disappears. That cannot be stressed highly enough! DO NOT CLOSE THE COMMAND WINDOW! BE PATIENT! LET IT FINISH! Now reboot and see if it made any difference in boot time.

A couple of additional notes:
First, the defragsvc will continue to show as "running" in the Services tab of Task Manager for a period of time, even after the command window goes away. It will eventually switch back to a "stopped" status all by its self. Second, on a clean install of Win7 you may not see a drastic improvement in boot times. It depends on how many drivers you had to install your self and how many were done by the Win7 install. It is perfectly safe to run this batch whenever you want, but the only time you NEED to run it is after you have updated a driver or an application that loads as a program at boot time or runs as a service (which are always loaded at boot time.)

One more parting warning: DO NOT CLOSE THE COMMAND WINDOW!

Gary
Attached Files
File Type: zip DefragBootFiles.zip (204 Bytes, 80 views)
ScuderiaConchiglia is offline   Reply With Quote
Old 10-29-2009, 04:05 AM   #2
brownstonemr
Notebook Geek
 
brownstonemr's Avatar
 
Join Date: Jul 2008
Posts: 97
Rep Power: 4 brownstonemr is on a distinguished road
Default Re: Defragmenting boot files under Win7

Thx for posting this. Have Win7 64 with a lot of drivers and startup programs installed myself and not through windows update.

However maybe the automated process had already kicked in cause I ran the file from desktop and there was no time gained when booting up. Shall try again after installing newer drivers or startup programs.
brownstonemr is offline   Reply With Quote
Old 10-29-2009, 11:00 AM   #3
ScuderiaConchiglia
NBR Vaio Team Curmudgeon
 
Join Date: Jun 2007
Posts: 4,625
Rep Power: 25 ScuderiaConchiglia has much to be proud ofScuderiaConchiglia has much to be proud ofScuderiaConchiglia has much to be proud ofScuderiaConchiglia has much to be proud ofScuderiaConchiglia has much to be proud ofScuderiaConchiglia has much to be proud ofScuderiaConchiglia has much to be proud ofScuderiaConchiglia has much to be proud ofScuderiaConchiglia has much to be proud ofScuderiaConchiglia has much to be proud ofScuderiaConchiglia has much to be proud of
Default Re: Defragmenting boot files under Win7

brownstonemr,

On a fresh, clean install, I am not surprised at the results you got. There would be very little fragmentation. Plus the jury is still out on how Win7 handles the automated process. They may have fixed it, I just don't know. I do know under Vista, unless you let your laptop sit idle (few of us do), the process never kicked in.

I think we'll know more over time as we try this after the Win7 has been in wide use for a few months.

Gary
ScuderiaConchiglia is offline   Reply With Quote
Old 10-30-2009, 01:11 AM   #4
grbac
Notebook Evangelist
 
grbac's Avatar
 
Join Date: Nov 2007
Location: Zagreb, Croatia
Posts: 499
Rep Power: 6 grbac is on a distinguished road
Default Re: Defragmenting boot files under Win7

Thanks man for sharing that. I just used your method, it finished within few minutes. Maybe BC I use regularly MyDefrag, famous ex-JKDefrag.exe. I'll update later with the gains. +Rep for that.
__________________
Forcebook IG (JFL92) , T9300 2.5GHz, GeForce 8600GT 512MB, 2GB DDR2 RAM 667, Seagate Momentus 100GB 7200.1, WSXGA+ 1680x1050
grbac is online now   Reply With Quote
Old 11-04-2009, 02:38 PM   #5
coolguy
Notebook Virtuoso
 
Join Date: Jun 2007
Location: Chicagoland
Posts: 2,810
Rep Power: 18 coolguy is just really nicecoolguy is just really nicecoolguy is just really nicecoolguy is just really nice
Default Re: Defragmenting boot files under Win7

I ran this in Windows 7 64-bit. The command window opened, "invoking boot file optimization" displayed after some time and then the command windows disappeared. I don't know if the optimization is complete. In the registry entry "HKLM > Dfrg > BootOptimizeFunction, it says "No" for OptimizeComplete.
coolguy is offline   Reply With Quote
Old 11-04-2009, 03:54 PM   #6
ScuderiaConchiglia
NBR Vaio Team Curmudgeon
 
Join Date: Jun 2007
Posts: 4,625
Rep Power: 25 ScuderiaConchiglia has much to be proud ofScuderiaConchiglia has much to be proud ofScuderiaConchiglia has much to be proud ofScuderiaConchiglia has much to be proud ofScuderiaConchiglia has much to be proud ofScuderiaConchiglia has much to be proud ofScuderiaConchiglia has much to be proud ofScuderiaConchiglia has much to be proud ofScuderiaConchiglia has much to be proud ofScuderiaConchiglia has much to be proud ofScuderiaConchiglia has much to be proud of
Default Re: Defragmenting boot files under Win7

Were you monitoring it with TaskManager and Resource monitor as suggested?

Gary
ScuderiaConchiglia is offline   Reply With Quote
Old 11-04-2009, 04:19 PM   #7
coolguy
Notebook Virtuoso
 
Join Date: Jun 2007
Location: Chicagoland
Posts: 2,810
Rep Power: 18 coolguy is just really nicecoolguy is just really nicecoolguy is just really nicecoolguy is just really nice
Default Re: Defragmenting boot files under Win7

Finally it ran successfully, when I tried it for the third time. I could see the registry entry "Yes" for BootOptimizeFunction now. I don't what was going on for the first two times I tried. I read somewhere that on a fresh Windows 7 install, Windows takes some time to start the auto boot optimization and the registry entries (not there before) will be created later, as I can see the new entries now.
coolguy is offline   Reply With Quote
Old 11-04-2009, 11:45 PM   #8
surfasb
Titles Shmm-itles
 
surfasb's Avatar
 
Join Date: Aug 2007
Location: Austin, TX
Posts: 4,301
Rep Power: 24 surfasb has much to be proud ofsurfasb has much to be proud ofsurfasb has much to be proud ofsurfasb has much to be proud ofsurfasb has much to be proud ofsurfasb has much to be proud ofsurfasb has much to be proud ofsurfasb has much to be proud ofsurfasb has much to be proud ofsurfasb has much to be proud ofsurfasb has much to be proud of
Default Re: Defragmenting boot files under Win7

Anyone notice a difference after doing this? I need a boot timer program....
__________________
Dell Inspiron 1420 HP tz2500 Tablet PC Lenovo X200T Dell XT2
Too close for missles/ Switching to guns
Jack Daniels/ Jim Beam/ Johnnie Walker/ Jose Cuervo
surfasb is offline   Reply With Quote
Old 11-05-2009, 12:06 AM   #9
ScuderiaConchiglia
NBR Vaio Team Curmudgeon
 
Join Date: Jun 2007
Posts: 4,625
Rep Power: 25 ScuderiaConchiglia has much to be proud ofScuderiaConchiglia has much to be proud ofScuderiaConchiglia has much to be proud ofScuderiaConchiglia has much to be proud ofScuderiaConchiglia has much to be proud ofScuderiaConchiglia has much to be proud ofScuderiaConchiglia has much to be proud ofScuderiaConchiglia has much to be proud ofScuderiaConchiglia has much to be proud ofScuderiaConchiglia has much to be proud ofScuderiaConchiglia has much to be proud of
Default Re: Defragmenting boot files under Win7

Quote:
Originally Posted by surfasb View Post
Anyone notice a difference after doing this? I need a boot timer program....
On a clean install or an upgrade? On a clean install you probably won't see much difference. On my upgrade I dropped about 30 seconds off the boot time.

As with Vista, this defrag will be more beneficial down the road as we install new drivers, new services and new apps that run at boot time.

I haven't seen any info about whether or not Microsoft tweaked the scheduled task under Win7 that is supposed to do this automatically. The way it was configured under Vista it rarely got run on most laptops.

Gary

Last edited by ScuderiaConchiglia : 11-10-2009 at 12:50 AM.
ScuderiaConchiglia is offline   Reply With Quote
Old 11-09-2009, 06:58 AM   #10
J&SinKTO
Notebook Consultant
 
Join Date: Oct 2008
Posts: 255
Rep Power: 4 J&SinKTO is on a distinguished road
Default Re: Defragmenting boot files under Win7

Just ran this on my clean install (Sony FW285). Improved about 15-20 seconds. Thanks much!
Rep
J&SinKTO is offline   Reply With Quote
Reply


Thread Tools


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 08:24 AM.



Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.

TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.

TechTarget Corporate Web Site  |  About Us  |  Advertising  |  Site Map  |  Contact Us  |  Submit Review  |  RSS Feeds  |  Jobs




All Rights Reserved, Copyright 1999 - 2007, TechTarget | Read our Privacy Policy
  TechTarget - The Most Targeted IT Media