Chkdsk windows server 2012

Thanks to a radical redesign the disk remains online during Server 2012’s chkdsk’s analysis phase.  Furthermore, the new chkdsk utility can analyze a terabyte disk in two minutes.

If there is any actual file corruption then chkdsk schedules a repair, and while ‘spot fix’ requires the disk to be dismounted briefly, there is no longer any need for a reboot if this is a data volume.

Using the Chkdsk Utility in Windows Server 2012

  • Chkdsk Theory and Goals
  • Chkdsk Reporting
  • Chkdsk Utility Example
  • Chkdsk Parameters (Switches)

 ♦

Chkdsk Theory and Goals

Disk health is vital, yet it’s probably the weakest link in a Windows Server 2012 computer system.  RAID provides a safety net to compensate for disk errors, but better still is curing disk corruptions at the NTFS level.

NTFS now has the intelligence to work out if the error is related to memory, and if so, it will direct online self-heal to correct this transient anomaly.

If the error is more serious, and the disk must taken offline, then the Server 2012 completes the repair in seconds rather than hours.  Chkdsk’s new techniques involve a lengthy, but online detection phase, followed by a very short offline phase dealing with just the disk corruption(s).  Previous versions of chkdsk had to take the disk offline to run the analysis phase, which could be interminably long on large volumes.

Chkdsk Reporting

While previous Windows operating systems, recorded zillions of disk events in the logs, it took experience and effort to sift serious disk problems from transient ‘normal’ errors. 

Windows Server 2012 makes a point of providing better reporting on drive status, see Action Center in the screenshot to the right.

Online Spot Verification
If self-heal does not fix the disk problem, then the file system briefly enters a transient state so that it can confirm there really is disk corruption.
Note: Spot Verification is different from Spot Fixing.

Online Scan
Once the checking phase confirms there really is a disk problem, the Action Center receives a message is sent to the Action Center that an ‘Online scan needed’.  The scan is run automatically at the next maintenance interval.  This scan should happen when Windows 2012 detects ‘idle time’, consequently, the server remains online.  Alternatively, if you see the message flag in the notification area, you can manually ‘Scan drive for errors’. 

Spot Fix Needed
Once the Online Scan determines there is an error NTFS calls for a spot fix.  On Windows Server 2012 you can repair the corrupt disk without a reboot provided it’s a data volume that’s affected.  However, if it’s a Windows 8 client – they share the same chkdsk technology – you would need a restart, as you would if it was system volume on the Windows 2012 server.

When you get a message in the action center saying: ‘Restart to repair drive errors’, instead of rebooting see if you can use the ‘Tools’ tab on volume properties, select ‘Error Checking’ and make a spot fix without restarting. See screenshot below right.

Chkdsk Utility Example (Use PowerShell or CMD)

Here below you can see the three stages of scanning the filesystem on the D: volume.

Chkdsk D: /scan

Stage 1: Examining basic file system structure …
Progress: Stage: 0%; Total: 0%; Time Remaining: 0:04:04
Progress: Stage: 5%; Total: 20%; Time Remaining: 0:02:20 …

Stage 2: Examining file name linkage …
Progress: Stage: 13%; Total: 24%; Time Remaining: 0:02:13
Progress: Stage: 88%; Total: 57%; Time Remaining: 0:00:24 ..

Stage 3: Examining security descriptors …
Progress: Stage: 0%; Total: 71%; Time Remaining: 0:00:24 …
Progress: Stage: 74%; Total: 77%; Time Remaining: 0:00:21 ..

Windows has scanned the file system and found no problems.
No further action is required.

Guy Recommends:  A Free Trial of the Network Performance Monitor (NPM) v12

SolarWinds’ Network Performance Monitor will help you discover what’s happening on your network.  This utility will also guide you through troubleshooting; the dashboard will indicate whether the root cause is a broken link, faulty equipment or resource overload.

Perhaps the NPM’s best feature is the way it suggests solutions to network problems.  Its second best feature is the ability to monitor the health of individual VMware virtual machines.  If you are interested in troubleshooting, and creating network maps, then I recommend that you give this Network Performance Monitor a try.

Download your free trial of SolarWinds Network Performance Monitor.

Server 2012 Chkdsk Utility Parameters

CHKDSK [volume[[path]filename]]] [/F] [/V] [/R] [/X] [/I] [/C] [/L[:size]] [/B] [/scan] [/spotfix]

  • Volume: The drive letter, or volume name, remember that colon (D:).
  • /F Fixes errors on the disk.
  • /V Displays cleanup messages if any.
  • /R Locates bad sectors and recovers readable information (implies /F, when /scan not specified).
  • /L:size  Changes the log file size to the specified number of kilobytes. If size is not specified, displays current size.
  • /X Forces the volume to dismount first if necessary.
    All opened handles to the volume would then be invalid (implies /F).
  • /I  Performs a less vigorous check of index entries.
  • /C Skips checking of cycles within the folder structure.
  • /B Re-evaluates bad clusters on the volume (implies /R)
  • /scan Runs a online scan on the volume
  • /forceofflinefix  (Must be used with «/scan») Bypass all online repair; all defects found are queued for offline repair (i.e. «chkdsk /spotfix»).
  • /perf  (Must be used with «/scan») Uses more system resources to complete a scan as fast as possible. This may have a negative performance impact on other tasks running on the system.
  • /spotfix  Runs spot fixing on the volume
  • /sdcleanup  Garbage collect unneeded security descriptor data (implies /F).
  • /offlinescanandfix Runs an offline scan and fix on the volume.

Note: that many parameters imply other parameters.  Incidentally, you have to precede the parameter with a forward slash (/), and not a dash (-).

Guy’s View on the New Chkdsk Utility

It was only after using hard disks for 5 years that it occurred to me that disk storage could give problem.  I took the view that disk failures only ever happened to other people and seemed about as likely as winning the lottery.  Two disk failures later and I have now gone to the other extreme, while it’s great that disk sizes continue to grow, I have become concerned that the technology is moving too fast, and disk manufactures are happy to trade extra performance for reliability.  Windows Server 2012 NTFS filesystem and chkdsky utility give me confidence that my disks are providing reliable data performance.

See more Windows Server 2012 features »

FREE White Paper: The ROI of Network Management & Monitoring

This is the equation we need to evaluate
ROI = (Gain from Investment – Cost of Investment) / Costs

Here are the factors to calculate your Return on Investment:

  • Staff time savings.                -v- Cost of Licenses
  • Less network downtime.         -v- Dedicated Hardware
  • Reduced support calls.           -v- Installation
  • Download your free copy

Summary Windows Server 2012 Chkdsk Utility

The first tool in troubleshooting disk corruption problems is chkdsk, the problem was that in Windows Server 2008 it seemed to take for ever to analyze even a modestly sized disk.  All that has changed with Server 2012’s chkdsk thanks to offline analysis and spot fixing. 

If you like this page then please share it with your friends


Microsoft Windows Server 2012 Topics

• Windows Server 2012 Home   • Disable UAC Windows Server 2012   • Server 2012 Chkdsk Utility

• Install Windows Server 2012   • PowerShell Add-WindowsFeature   • Network Performance Monitor

• Shutdown Windows Server 2012   • Disable Shutdown Event Tracker Server 2012

  • Running Defrag on a CSV:
  • Running ChkDsk on a CSV:
  • Detection of Corruptions – ChkDsk /Scan:
  • Resolution of CSV corruptions during Physical Disk Resource IsAlive Checks:
  • Running Defrag or ChkDsk through Repair-ClusterSharedVolume cmdlet:

First published on MSDN on Jan 01, 2014

Cluster Shared Volumes (CSV) is a layer of abstraction on either the ReFS or NTFS file system (which is used to format the underlying private cloud storage). Just as with a non-CSV volume, at times it may be necessary to run ChkDsk and Defrag on the file system. In this blog, I am going to first address the recommended procedure to run Defrag on your CSV, in Windows Server 2012 R2 and later. I will then discuss how ChkDsk is run on your CSVs.

Running Defrag on a CSV:

Fragmentation of files on a CSV can impact the perceived file system performance by increasing the seek time to retrieve file system metadata. It is therefore recommended to periodically run Defrag on your CSV volume. Fragmentation is primarily a concern when running dynamic VHDs and less prevalent with static VHDs. On a stand-alone server defrag runs as part of the “Maintenance Task”, so it runs automatically. However, on a CSV volume it will never run automatically, so you need to run it manually or script it to run (potentially using a

Clustered Scheduled Task

). It is recommended to conduct this process during non-peak production times, as performance may be impacted.  The following are the steps to defragment your CSV:

1.       Determine if defragmentation is required for your CSV by running the following on an elevated command prompt:

Defrag.exe <CSV Mount Point> /A /U /V

/A           Perform analysis on the specified volumes

/U           Print the progress of the operation on the screen

/V           Print verbose output containing the fragmentation statistics

Note:
If your CSV is backed by thinly provisioned storage, slab consolidation analysis (not the actual slab consolidation) is run during defrag analysis. Slab consolidation analysis requires the CSV to be placed in redirected mode before execution. Please refer to step 2, for instructions on how to place your CSV into redirected mode.

2.       If defragmentation is required for your CSV, put the CSV into redirected mode.  This can be achieve in either of the following ways:

a.       Using Windows PowerShell© open a new elevated Windows PowerShell console and run the following:

Suspend-ClusterResource

<Cluster Disk Name> -RedirectedAccess

b.      Using the Failover Cluster Manager right-click on the CSV and select “Turn On Redirected Access”:

Note:
If you attempt to run Defrag on a CSV without first putting it in redirected mode, it will fail with the following error:

CSVFS failed operation as volume is not in redirected mode. (0x8007174F)

You may also run into the following error:
This operation is not supported on this filesystem. (0x89000020)

3.       Run defrag on your CSV by running the following on an elevated command prompt:

Defrag.exe <CSV Mount Point>

4.       Once defrag has completed, revert the CSV back into direct mode by using either of the follow methods:

a.       Using Windows PowerShell© open a new elevated Windows PowerShell console and run the following:

Resume-ClusterResource

<Cluster Disk Name>

b.      Using the Failover Cluster Manager right-click on the CSV and select “Turn Off Redirected Access”:

Running ChkDsk on a CSV:

During the lifecycle of your file system corruptions may occur which require resolution through ChkDsk. As you are aware, CSVs in Windows Server 2012 R2 also supports the ReFS file system. However, the ReFS filesystem achieves self-healing through integrity checks on metadata. As a consequence, ChkDsk does not need to be run for CSV volumes with the ReFS file system. Thus, this discussion is scoped to corruptions in CSV with the NTFS file system. Also, note the

redesigned ChkDsk operation

introduced with Windows Server 2012, which separates the ChkDsk scan for errors (online operation) and the ChkDsk fix (offline operation). This results in higher availability for your Private Cloud storage since you only need to take your storage offline to fix corruptions in your storage (which is a significantly faster process than the scan for corruptions). In Windows Server 2012, we integrated ChkDsk /SpotFix into the cluster IsAlive health check for the Physical Disk Resource corresponding to the CSV. As a consequence we will now attempt to fix corruptions in your CSV without any perceptible downtime for your application.

Detection of Corruptions – ChkDsk /Scan:

The following is the workflow on Windows Server 2012 R2 or later systems to scan for NTFS corruptions:

Note:
If the system is never idle it is possible that the ChkDsk scan will never be run. In this case the administrator will need to invoke this operation manually. To invoke this operation manually, on an elevated command prompt run the following:

chkdsk.exe <CSV mount point name> /scan

Resolution of CSV corruptions during Physical Disk Resource IsAlive Checks:

The following is the CSV workflow in Windows Server 2012 R2 or later to fix corruptions:

Note:
In the rare event that a single CSV corruption takes greater than 15 seconds to fix, the above workflow will not resolve the error.  In this case the administrator will need to manually fix this error.  A CSV does not need to be place in maintenance or redirected mode before invoking chkdsk. The CSV will re-establish its state automatically once the chkdsk run has completed. To invoke this operation manually, on an elevated command prompt run the following:

chkdsk.exe <CSV mount point name> /SpotFix

Running Defrag or ChkDsk through Repair-ClusterSharedVolume cmdlet:

Running Defrag or ChkDsk on your CSV, through the Repair-ClusterSharedVolume, is deprecated with Windows Server 2012 R2 and the cmdlet has been removed completely in Windows Server 2016. It is instead highly encouraged to directly use either Defrag.exe or ChkDsk.exe for your CSV, using the procedure indicated in the preceding sections. While not recommended the use of the Repair-ClusterSharedVolume cmdlet is still supported by Microsoft. To use this cmdlet to run chkdsk or defrag, run the following on a new elevated Windows PowerShell console:

Repair-ClusterSharedVolume

<Cluster Disk Name> -ChkDsk –Parameters <ChkDsk parameters>

Repair-ClusterSharedVolume

<Cluster Disk Name> –Defrag –Parameters <Defrag parameters>

You can determine the Cluster Disk Name corresponding to your CSV using the Get-ClusterSharedVolume cmdlet by running the following:

Get-ClusterSharedVolume | fl *

Thanks!

Subhasish Bhattacharya

Senior Program Manager

Clustering and High Availability

Microsoft

Related Posts

Long back we had a very tough time on solving the Windows 2003 system volume corruption issue and the main challenge is we cannot predict the time consuming to complete the chkdisk.

One of our main Tier-1 Application was running on Windows 2003 in which we had a corruption issue and in windows 2003 we have to take the disk offline and the data would be unavailable for users until the chkdsk ran to repair the corruption and it depends on the number of files present in the volume and another most painful issue is for a single corruption ,the entire volume and all of its files would still be analyzed offline.

Fortunately Windows 2012 addresses the issue and introduced new model of managing the file system corruption .

Found the below article from the Microsoft TechNet Library which explains the new CHKDSK benefits and its features  .

Benefits ::

  • Customers can confidently deploy large volumes. Corruption-related downtime is now proportional to only the number of corruptions on the volume.
  • Customers who are using clustered shared volumes do not see any downtime, even for correcting corruption events that would normally require a remount.
  • Windows Server 2012 actively monitors the health state of the file system volume, and it always provides the health state to the administrator.
  • Customers do not see any downtime for transient corruption events.
  • Customers experience significantly fewer corruption events.

Features::

  • Improved self-healing: NTFS instantaneously self-heals more issues online without requiring chkdsk to run offline. This reduces the number of times that chkdsk is required to run.
  • Online analysis: In the previous model, almost all of the offline time required to run chkdsk was spent scanning and analyzing the drive. In Windows Server 2012, the analysis phase of chkdsk, which was responsible for the majority of the offline time, becomes an online, background task. This allows the volume to remain online and available while the system determines whether there is corruption. There is also added logic in the model that verifies the type of corruption is not transient, preventing unnecessary analysis.
  • Corruption correction: When the scan is completed, Windows Server 2012 informs the administrator (by using events and the management consoles), that the volumes need to be repaired and suggests a solution, such as performing a remount or reboot. Because the analysis phase has already completed, no additional scanning or detection is required. Chkdsk directly fixes the identified corruption, and the offline time is minimized to seconds. Therefore, the offline time for a volume is no longer proportional to the number of files on the volume, but rather to the number of corruptions on the volume.

Windows Server 2012 always provides the current health state of the file system volume by using standard events that indicate the current state of the volume. The following figure illustrates how significantly the new chkdsk model changes downtime in the event of corruption.

Reference : http://technet.microsoft.com/en-us/library

Furthermore, the new chkdsk utility can analyze a terabyte disk in two minutes.
If there is any actual file corruption then chkdsk schedules a repair, and while ‘spot fix’ requires the disk to be dismounted briefly, there is no longer any need for a reboot if this is a data volume.

Chkdsk Utility Example (Use PowerShell or CMD).

Chkdsk D: /scan

Stage 1: Examining basic file system structure …
Progress: Stage: 0%; Total: 0%; Time Remaining: 0:04:04
Progress: Stage: 5%; Total: 20%; Time Remaining: 0:02:20 …

Stage 2: Examining file name linkage …
Progress: Stage: 13%; Total: 24%; Time Remaining: 0:02:13
Progress: Stage: 88%; Total: 57%; Time Remaining: 0:00:24 ..

Stage 3: Examining security descriptors …
Progress: Stage: 0%; Total: 71%; Time Remaining: 0:00:24 …
Progress: Stage: 74%; Total: 77%; Time Remaining: 0:00:21 ..

Windows has scanned the file system and found no problems.
No further action is required.

Server 2012 Chkdsk Utility Parameters

CHKDSK [volume[[path]filename]]] [/F] [/V] [/R] [/X] [/I] [/C] [/L[:size]] [/B] [/scan] [/spotfix]

  • Volume: The drive letter, or volume name, remember that colon (D:).
  • /F Fixes errors on the disk.
  • /V Displays cleanup messages if any.
  • /R Locates bad sectors and recovers readable information (implies /F, when /scan not specified).
  • /L:size  Changes the log file size to the specified number of kilobytes. If size is not specified, displays current size.
  • /X Forces the volume to dismount first if necessary.
    All opened handles to the volume would then be invalid (implies /F).
  • /I  Performs a less vigorous check of index entries.
  • /C Skips checking of cycles within the folder structure.
  • /B Re-evaluates bad clusters on the volume (implies /R)
  • /scan Runs a online scan on the volume
  • /forceofflinefix  (Must be used with «/scan») Bypass all online repair; all defects found are queued for offline repair (i.e. «chkdsk /spotfix»).
  • /perf  (Must be used with «/scan») Uses more system resources to complete a scan as fast as possible. This may have a negative performance impact on other tasks running on the system.
  • /spotfix  Runs spot fixing on the volume
  • /sdcleanup  Garbage collect unneeded security descriptor data (implies /F).
  • /offlinescanandfix Runs an offline scan and fix on the volume.

Note: that many parameters imply other parameters.  Incidentally, you have to precede the parameter with a forward slash (/), and not a dash (-).

As many of you may know from firsthand experience, the chkdsk command is a necessary evil Windows uses to ensure file system integrity. Because NTFS is not immune to file system corruption uses the chkdsk tool to fix transient and permanent problems such as bad sectors, lost files, missing headers and corrupt links. The down side of is that chkdsk can take a long time to execute, depending on the number of files on the volume and it requires exclusive access to the disk, which means users could be waiting from few hours to few days to access the data.

Chkdsk has evolved over the years just as disk drives continue to explode in size. Back in the mid-1990s with NT 3.51, a 1 GB disk was considered a large drive. Now, we have terabyte disks, combined with storage controller RAID functionality, which allows us to configure extremely large LUNs. As disks get larger, administrators leverage the capacity for more users per disk, which translates to more user files. Unfortunately, chkdsk does not scale well when analyzing hundreds of millions of files, so administrators are reluctant to use large volumes due to increased potential downtime.

Over the years, improvements have been made to hasten chkdsk’s execution time. Switches have been added to chkdsk to skip extensive index and folder structure checking. Failover clusters can also be configured to skip running chkdsk when a dirty volume is brought online. But these improvements only mask the underlying problem: Scanning a large disk with millions of files takes a very long time. The table below shows approximate chkdsk execution times for major versions of Windows.

Operating System Version 2 Million Files 3 Million Files
NT4 SP6 48 hours 100+ hours
Windows 2000 4 hours 6 hours
Windows 2003 0.4 hour 0.7 hour
  200 Million Files 300 Million Files
Windows 2008 R2 5 hours 6.25 hours

Chkdsk revamped

In Windows Server 2012 and in Windows 8, enterprise-class customers can finally have confidence when deploying multiterabyte volumes. Chkdsk has been redesigned to run in two separate phases: an online phase for scanning the disk for errors and an offline phase for repairing the volume. This was done because the vast majority of time spent executing chkdsk is spent scanning the volume, while the repair phase only takes a few seconds.

Better yet, most of the new chkdsk functionality has been implemented transparently so you won’t even know its running. The analysis phase of chkdsk now runs as a background task. If NTFS suspects a problem in the file system, it attempts to self-heal it online. Errors of a transient nature are fixed on the fly with zero downtime. Any real corruption is flagged and logged for corrective action when it is convenient. In the meantime, the volume remains online to provide immediate access to your data.

Once every minute, the health of all physical disks is checked, and any problems are reported to event logs and management consoles, including the Action Center and the Server Manager. The corrective action usually involves remounting the drive, which takes just a few seconds. The amount of downtime for repairing corrupt volumes is now based on the number of errors to be fixed, not the size of the volume or the number of files.

Windows Failover Clusters using cluster shared volumes (CSVs) also benefit from the integrated chkdsk design by transparently fixing errors on the fly. Whenever any corruption errors are detected, I/O is transparently paused while fixes are made to repair the volume and then automatically resumed. This added resiliency makes CSVs continuously available to users with zero offline time.

The command line interface (CLI) chkdsk command is still available for fixing severely corrupt volumes. In fact, several new options have been added to support the new design, including /scan, /forceofflinefix, /spotfix and /offlinescanandfix. There is also a new cmdlet called repair-volume to offer the same chkdsk functionality with PowerShell. A brief description of the new PowerShell options is provided below.

Option Description
Repair-volume PowerShell cmdlet that performs repairs on a volume
OfflineScanAndFix Takes the volume offline to scan and fix any errors. Equivalent to chkdsk /f.
Scan Scans the volume without attempting to repair it. All detected corruption is added to the $corrupt system file. Equivalent to chkdsk /scan.
SpotFix Takes the volume offline briefly and then fixes only the issues that are logged in the $corrupt file. Equivalent to chkdsk /spotfix.

Source: Microsoft TechNet

For example, if you suspect severe corruption with a particular volume, you can manually repair the drive by first scanning it to record any errors in the $corrupt system file. Then, when it is convenient to take the drive offline briefly, use the –SpotFix option to fix the errors:

PS C:\> repair-volume –DriveLetter T –Scan

PS C:\> repair-volume –DriveLetter T -SpotFix

For more information on the repair-volume cmdlet, use the command get-help repair-volume –full.

Windows Server 2012 has many improvements to increase the availability of your data. Now you can have very large disks with hundreds of millions of files and not have to worry about chkdsk slowing your boot time. While most of the new chkdsk functionality is implemented transparently, the CLI chkdsk tool and the new repair-volume PowerShell cmdlet provide administrators with the ability to fix volumes manually.

Понравилась статья? Поделить с друзьями:
0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • Gamepad emulator for windows
  • Как включить тачпад на ноутбуке asus windows 11
  • Параметры автозапуска программ в windows 7
  • Как сделать виджеты на рабочий стол windows 10
  • Ftp сервер for windows