Bad NTFS volumes may be fixed in Windows 2012/2012R2 in two steps, using powershell, as follows:
1. Create a list of the issues on the volume while the volume is on line
2. Repair the issues found above while taking off line the volume to be repaired for only a few seconds, rarely a few minutes.
To achive this, please open an elevated Powershell Console.
1. Run
Get-Volume
to list the available volumes for the machine to be checked.
You will get a table similar with the one below:
DriveLetter FileSystemLabel FileSystem DriveType HealthStatus SizeRemaining Size
----------- --------------- ---------- --------- ------------ ------------- ----
System Reserved NTFS Fixed Healthy 72.95 MB 350 MB
R ReFS ReFS Fixed Healthy 830.88 MB 99.81 GB
E NTFS NTFS Fixed Healthy 33.78 GB 99.87 GB
C NTFS Fixed Healthy 30.18 GB 99.66 GB
A Removable Healthy 0 B 0 B
D SQLServer CDFS CD-ROM Healthy 0 B 3.63 GB
Please note the DriveLetter, FileSystemLabel and HealthStatus columns.
If you want to repair Junction Point Volumes, you may need to use the FileSystemLabelInformation; otherwise, the easy way is to use the DriveLetter.
In the example above, volume R: cannot be checked as ReFS is not supported.
2. Do an on line scan of the Volume. Run
repair-volume -Scan -DriveLetter <drive_letter>
(i.e. repair-volume -Scan -DriveLetter E -- please note that the the ":" is not used to designate the drive).
or, if using the FileSystemLabel column to identify the volume, run
repair-volume -FileSystemLabel <volume_Label> -Scan
repair-volume -FileSystemLabel "NTFS" -Scan
3. If the result of the scan shows that there is corruption on the volume,run
repair-volume -Spotfix -DriveLetter <drive_letter>
or
repair-volume -FileSystemLabel <volume_label> -Spotfix
The volume will be taken offline for a short time to perform the repair.
Note 1: You know if there are errors on the volume either by the message you receive after running the command or by running "get-volume" again and check the HealthStatus column.
Note 2: If the expected time necessary to scan the volumes is rather long, you may choose to run the scan on a separate thread so you can use the PowerShell session for something else. To do this, run:
repair-volume -FileSystemLabel <volume_Label> -Scan -AsJob