This project has moved and is read-only. For the latest updates, please go here.

chkdsk.exe /F/R detects bad sectors on Truecrypt and Veracrypt containers when mounted with Veracrypt 1.0.f-2

Topics: Technical Issues
May 9, 2015 at 6:47 PM
Hi team, hello Mounir,

On Windows 7, chkdsk.exe /F/R detects bad sectors on Truecrypt and Veracrypt containers when mounted with Veracrypt 1.0.f-2.

I used several combinations like creating Veracrypt containers with Serpent+Whirpool or AES+SHA512, with NTFS-4kb block sector and a container size of 32,000,000 Kb.

A chkdsk.exe on the hard disk partition itself (hosting the containers) does not reveal any bad sector.

Moreover if I create a Truecrypt container with Truecrypt 7.1a and if I mount it with TC 7.1a and if I run chkdsk.exe /F/R, then I get no bad sector.

Now if I mount the exact same TC container with VeraCrypt 1.0.f-2 (released on April 5), then chkdsk.exe /F/R does detect 31 bad sectors at the end of the mounted disk.

I can send screenshots in private mail if needed.

Thanks for your help and your suggestions!

Best regards,
GrandLion
May 9, 2015 at 8:06 PM
Edited May 9, 2015 at 8:41 PM
I get the same result when running check disk against TrueCrypt 7.1a file containers using NTFS or FAT format mounted in TrueCrypt Mode using the 1.0f-2 version of VeraCrypt.

I created two new test file containers using TruCrypt 7.1a version using NTFS and FAT format.

I created ticket listed below.

https://veracrypt.codeplex.com/workitem/141

Check Disk Mounted in TrueCrypt NTFS Formatted
C:\>chkdsk /f /r Q:
The type of the file system is NTFS.

CHKDSK is verifying files (stage 1 of 5)...
  256 file records processed.
File verification completed.
  0 large file records processed.
  0 bad file records processed.
  0 EA records processed.
  0 reparse records processed.
CHKDSK is verifying indexes (stage 2 of 5)...
  274 index entries processed.
Index verification completed.
  0 unindexed files scanned.
  0 unindexed files recovered.
CHKDSK is verifying security descriptors (stage 3 of 5)...
  256 file SDs/SIDs processed.
Security descriptor verification completed.
  9 data files processed.
CHKDSK is verifying file data (stage 4 of 5)...
  240 files processed.
File data verification completed.
CHKDSK is verifying free space (stage 5 of 5)...
  1542 free clusters processed.
Free space verification is complete.
Windows has checked the file system and found no problems.

      9983 KB total disk space.
      1088 KB in 3 files.
         4 KB in 11 indexes.
         0 KB in bad sectors.
      2719 KB in use by the system.
      2048 KB occupied by the log file.
      6172 KB available on disk.

      4096 bytes in each allocation unit.
      2495 total allocation units on disk.
      1543 allocation units available on disk.
Check Disk Mounted in VeraCrypt NTFS Formatted
C:\>chkdsk /f /r Q:
The type of the file system is NTFS.

CHKDSK is verifying files (stage 1 of 5)...
  256 file records processed.
File verification completed.
  0 large file records processed.
  0 bad file records processed.
  0 EA records processed.
  0 reparse records processed.
CHKDSK is verifying indexes (stage 2 of 5)...
  278 index entries processed.
Index verification completed.
  0 unindexed files scanned.
  0 unindexed files recovered.
CHKDSK is verifying security descriptors (stage 3 of 5)...
  256 file SDs/SIDs processed.
Security descriptor verification completed.
  11 data files processed.
CHKDSK is verifying file data (stage 4 of 5)...
  240 files processed.
File data verification completed.
CHKDSK is verifying free space (stage 5 of 5)...
  1542 free clusters processed.
Free space verification is complete.
Adding 32 bad clusters to the Bad Clusters File.
Correcting errors in the Volume Bitmap.
Windows has made corrections to the file system.

      9983 KB total disk space.
      1092 KB in 4 files.
         4 KB in 13 indexes.
       128 KB in bad sectors.
      2719 KB in use by the system.
      2048 KB occupied by the log file.
      6040 KB available on disk.

      4096 bytes in each allocation unit.
      2495 total allocation units on disk.
      1510 allocation units available on disk.
Check Disk Mounted in VeraCrypt FAT Formatted
C:\>chkdsk /f /r Q:
The type of the file system is FAT.
Volume Serial Number is 5C69-B567
Windows is verifying files and folders...
File and folder verification is complete.
Windows is verifying free space...
Bad sectors found.ted.....
Free space verification is complete.
Windows has made corrections to the file system.

   10,166,272 bytes total disk space.
      136,192 bytes in bad sectors.
   10,030,080 bytes available on disk.

        1,024 bytes in each allocation unit.
        9,928 total allocation units on disk.
        9,795 allocation units available on disk.
May 9, 2015 at 8:37 PM
Thanks Enigma2Illusion.

FYI - I have also tried with the latest nightly "Veracrypt 1-11beta" dated May 6th,
because the change log of this beta did mentioned "Make volumes correctly report Physical Sector size to Windows",
but the bug described above is still present with this Veracrypt 1-11beta.

Best regards,
GrandLion
May 9, 2015 at 11:09 PM
Edited May 9, 2015 at 11:25 PM
Hello GrandLion,

Did you notice that if you perform the disk check (Repair Filesystem) via the VeraCrypt GUI, you do not get bad sectors being reported?

Check Disk Mounted in VeraCrypt NTFS Format via the VeraCrypt GUI
Attempting to repair the file system on the VeraCrypt volume mounted as Q:...
The type of the file system is NTFS.

CHKDSK is verifying files (stage 1 of 3)...
  256 file records processed.
File verification completed.
  0 large file records processed.
  0 bad file records processed.
  0 EA records processed.
  0 reparse records processed.
CHKDSK is verifying indexes (stage 2 of 3)...
  274 index entries processed.
Index verification completed.
  0 unindexed files scanned.
  0 unindexed files recovered.
CHKDSK is verifying security descriptors (stage 3 of 3)...
  256 file SDs/SIDs processed.
Security descriptor verification completed.
  9 data files processed.
Windows has checked the file system and found no problems.

      9983 KB total disk space.
      1088 KB in 3 files.
         4 KB in 11 indexes.
         0 KB in bad sectors.
      2719 KB in use by the system.
      2048 KB occupied by the log file.
      6172 KB available on disk.

      4096 bytes in each allocation unit.
      2495 total allocation units on disk.
      1543 allocation units available on disk.
Press any key to continue . . .
Any ideas why the difference?
May 10, 2015 at 12:38 AM
Hi,

Actually, the reported bad sectors are false positives: there is no issue in data storage but there was a stupid bug in the handing of the IOCTL_DISK_VERIFY in VeraCrypt driver, and chkdsk uses this IOCTL for sector verification.

I committed a fix for this (wrong variable used): https://veracrypt.codeplex.com/SourceControl/changeset/23faa8493ee5bc0d273a2eabd4ce7b6cf6aeb8f6

And I uploaded a new 1.11-BETA binary to the nightly builds folder: https://sourceforge.net/projects/veracrypt/files/VeraCrypt%20Nightly%20Builds/

Can you please check if it is OK for you?
May 10, 2015 at 1:01 AM
Edited May 10, 2015 at 1:18 AM
Hello Mounir,

The latest beta fixed the issue reported by GrandLion in my tests for both NTFS and FAT volumes created with TrueCrypt 7.1a version and mounted using the latest beta VeraCrypt version.


Outstanding responsiveness to this issue!

Many thanks as always.


GrandLion,

Do you concur that the latest beta resolves the issue you reported?

PS:
Any ideas why the difference?
Mounir explains in the ticket:
As for the difference with the "Repair Filesystem" option in VeraCypt, it is simple: in VeraCrypt, we only check the filesystem as its name indicates (/F option). We don't check for bad sectors because it would take hours on big disks (/R option).
.

Kind Regards,
Enigma2Illusion
May 10, 2015 at 9:12 AM
Hello Mounir, hello Enigma2Illusion,

I'm pleased to confirm that for me as well, the issue is fixed in the last 1.11-beta (May 9).
Thanks very much for this awesomely fast resolution!

I wish you a nice weekend to both of you.

Best regards,
GrandLion
May 10, 2015 at 1:57 PM
Thank you also for reporting this issue. Community feedback like yours are important to keep VeraCrypt robust and secure.

Have a nice Sunday.