how to force CHKDSK on all local drives?

  • Thread starter someone watching
  • Start date
S

someone watching

I researched this on google and found nothing. There's plenty on how to check a specific volume but found nothing on checking ALL local drives at boot.

It appears chkdsk has no command line switch for /all drives or a parameter file (like earlier versions). Anyone know how to do it?
Thanks
 
B

Billns

I researched this on google and found nothing. There's plenty on how to
check a specific volume but found nothing on checking ALL local drives
at boot.
It appears chkdsk has no command line switch for /all drives or a
parameter file (like earlier versions). Anyone know how to do it?
Thanks

You could create a batch file that runs at startup:

chkdsk c:
chkdsk d:
chkdsk e:
etc.

Why you would want to do this at every startup is beyond me. I seldom
have the need to run chkdsk.

Bill
 
S

someone watching

Billns said:
You could create a batch file that runs at startup:

That's an idea, but where do I place the bat (or CMD?) file and where does
the command line go to execute it before GUI?

BTW, don't want to do this every time but occasionally, especially for
surface scan feature.
 
L

LD5SZRA

ChkDsk is not something you want to run every time you boot your
system because it slows down everything and frustration builds up
resulting in people smashing their computers.

Oh, by the way don't listen to Twayne because he is, what Pig-Bear
says, a "known troll" around here!

hth

someone watching wrote:

I researched this on google and found nothing. There's plenty on
how to check a specific volume but found nothing on checking ALL
local drives at boot.

It appears chkdsk has no command line switch for /all drives or
a parameter file (like earlier versions). Anyone know how to do
it?
Thanks

--
THE INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
KIND. LD5SZRA DISCLAIMS ALL WARRANTIES, EITHER EXPRESSED OR
IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL LD5SZRA
OR ITS ASSOCIATES BE LIABLE FOR ANY DAMAGES WHATSOEVER
INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF
BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF LD5SZRA OR ITS
ASSOCIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR
LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL
DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright LD5SZRA 2010.
 
J

John John - MVP

someone said:
That's an idea, but where do I place the bat (or CMD?) file and where does
the command line go to execute it before GUI?

BTW, don't want to do this every time but occasionally, especially for
surface scan feature.

From the onset it should be noted that the startup disk check tool is
Autochk.exe, this native NT application is designed to check the disk
without the support of the Win32 subsystem, otherwise it does the same
thing as Chkdsk. There are two ways to have Chkdsk run when the
computer starts, Autochk will run if you schedule it to run or by
default it will run if the volume's dirty bit is set. If the operating
system detects problems it will automatically set the dirty bit and the
volume will be checked at the next startup. The dirty bit can also be
set manually but it is best not to do this and to leave the setting of
the dirty bit to the operating system because once set the dirty bit
cannot be changed and while the boot time check can be skipped it cannot
be canceled. On the other hand, a scheduled Chkdsk without the dirty
bit can be canceled at any time.

If you still want to use the "dirty bit" method just create a batch file
that will use the fsutil command to set the dirty bit on the volumes,
use a line for each of the volumes, for example to set the dirty bit on
volumes C, E, F & G:

====================================
fsutil dirty set C:
fsutil dirty set E:
fsutil dirty set F:
fsutil dirty set G:

====================================

Anytime you run the batch file the dirty bit will be set and chkdsk will
run against the volumes when Windows is rebooted. As noted earlier,
once set the dirty bit cannot be removed and while you can skip the
chkdsk it cannot be canceled, you have to let ckkdsk run to remove the
dirty bit.



Manually scheduled Check Disks are recorded at the BootExecute value at:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager

These schedule disk checks can be canceled by simply returning the
BootExecute value to its default value, this can be done with the
Chkntfs command:

chkntfs /d


To manually schedule a Chkdsk at the next reboot:

First run the chkntfs /d command to set the BootExecute value to its
defaults, then:


On the Windows volume, assumes the volume is C:

At the command prompt issue:

chkdsk c: /f

Chkdsk will return a message telling you that it cannot lock or dismount
the volume and ask you if you want to schedule a Chkdsk at the next
restart, answer Yes.

For dismountable data volumes, for example, volume D:

Open a file on the volume, or explore the volume with Explorer. Then at
the Command prompt issue:

chkdsk d: /f

Chkdsk will inform you that the volume is being used by another process
and it will ask you if you want to force a dismount on the volume,
answer No. Chkdsk will then ask you if you want to schedule a Chkdsk at
the next restart, answer Yes.

Do the same for the other drives that you want checked at boot time,
open a file on the volume and run the chkdsk command against the volume
and have it schedule a boot time disk check.

Now the drives are scheduled to run at the next restart. To do this in
a semi-automated manner, after doing the above:

Using Regedit export the
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager] key.

This exported file will be fairly large, edit the saved file and
remove/delete everything except the BootExecute value, the edited file
will look like this:

==========================================================
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager]
"BootExecute"=hex(7):61,00,75,00,74,00,6f,00,63,00,68,00,65,00,63,00,6b,00,20,
......... with a long series of numbers.

=====================================================

(Leave a blank line at the end of the file.) You only want to save the
BootExecute value, nothing else!

Save the edited .reg file and when you want to schedule the Chkdsk merge
it to the registry.

To reset the BootExecute value and cancel all scheduled Chkdsk at the
command prompt issue:

chkntfs /d

John
 
S

someone watching

John, very interesting and informative post! I knew disks were checked when
the 'dirty bit' was set but didn't know how to set it. Also didn't know only
chkdsk could UNset it! This technique will come in handy when away for a day
and want all volumes scanned. There is a question there however; being I'd
like SURFACE SCAN (chkdsk /f /R), how can one have surface scan automated at
startup? Does the registry have a entry for changing chkdsk defaults?

Regarding entering chkdsk in a cmd window for each volume and following the
prompts; great idea, have tried it and it works well albeit I did not try
with /R switch (only /F).

Lastly, pretty neat with the BootExecute registry trick! It's an option I'll
keep in mind (in fact I've already saved your post for future reference).

For what I'm wanting to do it looks like seeting the dirty bit would be the
fastest and easiest method, provided chkdsk will automatically start (and
run) with the /R switch ... so if you know how to have chkdsk start with a
dirty bit with the /R switch, please let me know.

Many thanks!
 
J

John John - MVP

someone said:
John, very interesting and informative post! I knew disks were checked when
the 'dirty bit' was set but didn't know how to set it. Also didn't know only
chkdsk could UNset it! This technique will come in handy when away for a day
and want all volumes scanned. There is a question there however; being I'd
like SURFACE SCAN (chkdsk /f /R), how can one have surface scan automated at
startup? Does the registry have a entry for changing chkdsk defaults?

Regarding entering chkdsk in a cmd window for each volume and following the
prompts; great idea, have tried it and it works well albeit I did not try
with /R switch (only /F).

Lastly, pretty neat with the BootExecute registry trick! It's an option I'll
keep in mind (in fact I've already saved your post for future reference).

For what I'm wanting to do it looks like seeting the dirty bit would be the
fastest and easiest method, provided chkdsk will automatically start (and
run) with the /R switch ... so if you know how to have chkdsk start with a
dirty bit with the /R switch, please let me know.

There are no user configurable settings for the way chkdsk runs on dirty
volumes, this is coded within the operating system and it can't be changed.

You can use the /r switch with user scheduled chkdsk, no need to use the
/f switch with the /r switch, /r implies /f.

By the way, none of my business, but running chkdsk as a preventive
maintenance routine on NTFS volumes is for most parts completely
unnecessary, NTFS is self healing and the operating system constantly
verifies and corrects any files system or disk errors without user
knowledge or intervention. Chkdsk can be run if you suspect errors or
problems but otherwise you can run for *years* without ever running a
chkdsk and this would in no way put your machine at greater risk than
one where chkdsk was regularly run. Also keep in mind that there is
*always* a risk of data loss when chkdsk is run, your backups should be
up to date before you run chkdsk!

John
 
B

Billns

That's an idea, but where do I place the bat (or CMD?) file and where does
the command line go to execute it before GUI?

BTW, don't want to do this every time but occasionally, especially for
surface scan feature.
You could run the batch file at shutdown instead. If you are using the
/f parameter chkdsk won't run on the OS partition but will offer to run
on the next boot. As John has pointed out it's very seldom necessary to
run chkdsk on NTFS volumes.

I'd run a low-level disk diagnostic tool, such as SMART if your bios
supports it, if I were really concerned about surface scan.

Bill
 
A

Andrew E.

Try run,type: CLEANMGR /SAGESET Choose the options,once thru,return
to run,type: CLEANMGR /SAGERUN
This also works in cmd prompt,with that option,you might type:
CLEANMGR /SAGERUN /Scanboot
 
B

Bob I

Perhaps you replied to the wrong thread, again.
Try run,type: CLEANMGR /SAGESET Choose the options,once thru,return
to run,type: CLEANMGR /SAGERUN
This also works in cmd prompt,with that option,you might type:
CLEANMGR /SAGERUN /Scanboot

:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top