Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NTFS errors after forced shutdown #316

Open
superbonaci opened this issue Aug 3, 2023 · 1 comment
Open

NTFS errors after forced shutdown #316

superbonaci opened this issue Aug 3, 2023 · 1 comment

Comments

@superbonaci
Copy link

superbonaci commented Aug 3, 2023

Steps to reproduce

  1. Buy some spinning mechanical drive
  2. Connect it to Windows 11, usually comes formatted as NTFS.
  3. Encrypt the drive with BitLocker
  4. Mount it under Arch linux, using version dislocker 0.7.3-4
  5. Install qBittorrent and select as download directory the mounted drive
  6. Download several torrents, some with the qBittorrent option Pre-allocate disk space for all files enabled, and other disabled. See this bug for more information: The documentation for Pre-allocate disk space for all files is incomplete qbittorrent/qBittorrent#19398
  7. After several hours of use, pause all torrents
  8. The issue I experimented is that, although all the torrents were paused/stopped, (see issue Change Pause to Stop qbittorrent/qBittorrent#19041), the hard drive still kept spinning for several minutes and didn't stop. There were some kind of transactions going on that never ended. So
  9. When this happens, force shutdown the machine.
  10. Connect the drive to Windows 11 again and run chkdsk. These are the errors:
PS B:\> chkdsk
The type of the file system is NTFS.
Volume label is DSK1.

WARNING!  /F parameter not specified.
Running CHKDSK in read-only mode.

Stage 1: Examining basic file system structure ...
Attribute list entry with type code 80 in file 134 is corrupt.
Attribute list entry with type code 80 in file 134 is corrupt.
Attribute list entry with type code 80 in file 134 is corrupt.
The total allocated size in attribute record (80, "")
of file 4000000000134 is incorrect.
Deleted corrupt attribute list entry
with type code 80 in file 134.
Attribute record (80, "") from file record segment 134
is corrupt.
Attribute record (80, "") from file record segment BF1B
is corrupt.
Attribute record (80, "") from file record segment BF3F
is corrupt.
Attribute record (80, "") from file record segment BF48
is corrupt.
Attribute list entry with type code 80 in file 14C is corrupt.
Deleted corrupt attribute list entry
with type code 80 in file 14C.
Attribute record (80, "") from file record segment 14C
is corrupt.
Attribute record (80, "") from file record segment BF38
is corrupt.
Attribute list entry with type code 80 in file 165 is corrupt.
Deleted corrupt attribute list entry
with type code 80 in file 165.
Attribute record (80, "") from file record segment 165
is corrupt.
Attribute record (80, "") from file record segment BF40
is corrupt.
Attribute list entry with type code 80 in file 191 is corrupt.
Deleted corrupt attribute list entry
with type code 80 in file 191.
Attribute record (80, "") from file record segment 191
is corrupt.
Attribute record (80, "") from file record segment 1A9
is corrupt.
Attribute list entry with type code 80 in file 193 is corrupt.
Deleted corrupt attribute list entry
with type code 80 in file 193.
Attribute record (80, "") from file record segment 193
is corrupt.
Attribute record (80, "") from file record segment BF3B
is corrupt.
Attribute list entry with type code 80 in file 194 is corrupt.
Deleted corrupt attribute list entry
with type code 80 in file 194.
Attribute record (80, "") from file record segment 194
is corrupt.
Attribute record (80, "") from file record segment BF33
is corrupt.
Attribute list entry with type code 80 in file 19F is corrupt.
Deleted corrupt attribute list entry
with type code 80 in file 19F.
Attribute record (80, "") from file record segment 19F
is corrupt.
Attribute record (80, "") from file record segment BF3C
is corrupt.
Attribute list entry with type code 80 in file 1A7 is corrupt.
Deleted corrupt attribute list entry
with type code 80 in file 1A7.
Attribute record (80, "") from file record segment 1A7
is corrupt.
Attribute record (80, "") from file record segment BF37
is corrupt.
Attribute list entry with type code 80 in file 1AF is corrupt.
Attribute list entry with type code 80 in file 1AF is corrupt.
Attribute list entry with type code 80 in file 1AF is corrupt.
The total allocated size in attribute record (80, "")
of file 40000000001AF is incorrect.
Deleted corrupt attribute list entry
with type code 80 in file 1AF.
Attribute record (80, "") from file record segment 1AF
is corrupt.
Attribute record (80, "") from file record segment 9285
is corrupt.
Attribute record (80, "") from file record segment BF44
is corrupt.
Attribute record (80, "") from file record segment BF4B
is corrupt.
Attribute list entry with type code 80 in file 1B6 is corrupt.
Deleted corrupt attribute list entry
with type code 80 in file 1B6.
Attribute record (80, "") from file record segment 1B6
is corrupt.
Attribute record (80, "") from file record segment BF31
is corrupt.
Attribute list entry with type code 80 in file 1C1 is corrupt.
Attribute list entry with type code 80 in file 1C1 is corrupt.
Attribute list entry with type code 80 in file 1C1 is corrupt.
The total allocated size in attribute record (80, "")
of file 40000000001C1 is incorrect.
Deleted corrupt attribute list entry
with type code 80 in file 1C1.
Attribute record (80, "") from file record segment 1C1
is corrupt.
Attribute record (80, "") from file record segment BF2F
is corrupt.
Attribute record (80, "") from file record segment BF45
is corrupt.
Attribute record (80, "") from file record segment BF4A
is corrupt.
Attribute list entry with type code 80 in file 1E7 is corrupt.
Deleted corrupt attribute list entry
with type code 80 in file 1E7.
Attribute record (80, "") from file record segment 1E7
is corrupt.
Attribute record (80, "") from file record segment BF41
is corrupt.
Attribute list entry with type code 80 in file 1EB is corrupt.
Attribute list entry with type code 80 in file 1EB is corrupt.
Attribute list entry with type code 80 in file 1EB is corrupt.
The total allocated size in attribute record (80, "")
of file 40000000001EB is incorrect.
Deleted corrupt attribute list entry
with type code 80 in file 1EB.
Attribute record (80, "") from file record segment 1EB
is corrupt.
Attribute record (80, "") from file record segment BF2E
is corrupt.
Attribute record (80, "") from file record segment BF43
is corrupt.
Attribute record (80, "") from file record segment BF49
is corrupt.
Attribute list entry with type code 80 in file 1F5 is corrupt.
Deleted corrupt attribute list entry
with type code 80 in file 1F5.
Attribute record (80, "") from file record segment 1F5
is corrupt.
Attribute record (80, "") from file record segment 14D
is corrupt.
Attribute list entry with type code 80 in file 208 is corrupt.
Deleted corrupt attribute list entry
with type code 80 in file 208.
Attribute record (80, "") from file record segment 208
is corrupt.
Attribute record (80, "") from file record segment BF3A
is corrupt.
Attribute list entry with type code 80 in file 92E1 is corrupt.
Deleted corrupt attribute list entry
with type code 80 in file 92E1.
Attribute record (80, "") from file record segment 92E1
is corrupt.
Attribute record (80, "") from file record segment BF3D
is corrupt.
Attribute list entry with type code 80 in file 92EA is corrupt.
Deleted corrupt attribute list entry
with type code 80 in file 92EA.
Attribute record (80, "") from file record segment 92EA
is corrupt.
Attribute record (80, "") from file record segment BF3E
is corrupt.
Attribute list entry with type code 80 in file 930E is corrupt.
Attribute list entry with type code 80 in file 930E is corrupt.
Attribute list entry with type code 80 in file 930E is corrupt.
The total allocated size in attribute record (80, "")
of file 300000000930E is incorrect.
Deleted corrupt attribute list entry
with type code 80 in file 930E.
Attribute record (80, "") from file record segment 930E
is corrupt.
Attribute record (80, "") from file record segment BF1F
is corrupt.
Attribute record (80, "") from file record segment BF42
is corrupt.
Attribute record (80, "") from file record segment BF4C
is corrupt.
  48977 file records processed.
File verification completed.
 Phase duration (File record verification): 15.40 seconds.
File record segment 14D is an orphan.
File record segment 1A9 is an orphan.
File record segment 9285 is an orphan.
File record segment BF1B is an orphan.
File record segment BF1F is an orphan.
File record segment BF2E is an orphan.
File record segment BF2F is an orphan.
File record segment BF31 is an orphan.
File record segment BF33 is an orphan.
File record segment BF37 is an orphan.
File record segment BF38 is an orphan.
File record segment BF3A is an orphan.
File record segment BF3B is an orphan.
File record segment BF3C is an orphan.
File record segment BF3D is an orphan.
File record segment BF3E is an orphan.
File record segment BF3F is an orphan.
File record segment BF40 is an orphan.
File record segment BF41 is an orphan.
File record segment BF42 is an orphan.
File record segment BF43 is an orphan.
File record segment BF44 is an orphan.
File record segment BF45 is an orphan.
File record segment BF48 is an orphan.
File record segment BF49 is an orphan.
File record segment BF4A is an orphan.
File record segment BF4B is an orphan.
File record segment BF4C is an orphan.
  172 large file records processed.
 Phase duration (Orphan file record recovery): 2.03 milliseconds.

Errors found.  CHKDSK cannot continue in read-only mode.
PS B:\> chkdsk /F
The type of the file system is NTFS.
Cannot lock current drive.

Chkdsk cannot run because the volume is in use by another
process.  Chkdsk may run if this volume is dismounted first.
ALL OPENED HANDLES TO THIS VOLUME WOULD THEN BE INVALID.
Would you like to force a dismount on this volume? (Y/N) Y
Volume dismounted.  All opened handles to this volume are now invalid.
Volume label is DSK1.

Stage 1: Examining basic file system structure ...
Deleted corrupt attribute list entry
with type code 80 in file 134.
Deleted corrupt attribute list entry
with type code 80 in file 134.
Deleted corrupt attribute list entry
with type code 80 in file 134.
Correcting total allocated size in attribute record (80, "")
of file 4000000000134.
Deleted corrupt attribute list entry
with type code 80 in file 134.
Deleting corrupt attribute record (0x80, "")
from file record segment 0x134.
Deleting corrupt attribute record (0x80, "")
from file record segment 0xBF1B.
Deleting corrupt attribute record (0x80, "")
from file record segment 0xBF3F.
Deleting corrupt attribute record (0x80, "")
from file record segment 0xBF48.
Deleted corrupt attribute list entry
with type code 80 in file 14C.
Deleted corrupt attribute list entry
with type code 80 in file 14C.
Deleting corrupt attribute record (0x80, "")
from file record segment 0x14C.
Deleting corrupt attribute record (0x80, "")
from file record segment 0xBF38.
Deleted corrupt attribute list entry
with type code 80 in file 165.
Deleted corrupt attribute list entry
with type code 80 in file 165.
Deleting corrupt attribute record (0x80, "")
from file record segment 0x165.
Deleting corrupt attribute record (0x80, "")
from file record segment 0xBF40.
Deleted corrupt attribute list entry
with type code 80 in file 191.
Deleted corrupt attribute list entry
with type code 80 in file 191.
Deleting corrupt attribute record (0x80, "")
from file record segment 0x191.
Deleting corrupt attribute record (0x80, "")
from file record segment 0x1A9.
Deleted corrupt attribute list entry
with type code 80 in file 193.
Deleted corrupt attribute list entry
with type code 80 in file 193.
Deleting corrupt attribute record (0x80, "")
from file record segment 0x193.
Deleting corrupt attribute record (0x80, "")
from file record segment 0xBF3B.
Deleted corrupt attribute list entry
with type code 80 in file 194.
Deleted corrupt attribute list entry
with type code 80 in file 194.
Deleting corrupt attribute record (0x80, "")
from file record segment 0x194.
Deleting corrupt attribute record (0x80, "")
from file record segment 0xBF33.
Deleted corrupt attribute list entry
with type code 80 in file 19F.
Deleted corrupt attribute list entry
with type code 80 in file 19F.
Deleting corrupt attribute record (0x80, "")
from file record segment 0x19F.
Deleting corrupt attribute record (0x80, "")
from file record segment 0xBF3C.
Deleted corrupt attribute list entry
with type code 80 in file 1A7.
Deleted corrupt attribute list entry
with type code 80 in file 1A7.
Deleting corrupt attribute record (0x80, "")
from file record segment 0x1A7.
Deleting corrupt attribute record (0x80, "")
from file record segment 0xBF37.
Deleted corrupt attribute list entry
with type code 80 in file 1AF.
Deleted corrupt attribute list entry
with type code 80 in file 1AF.
Deleted corrupt attribute list entry
with type code 80 in file 1AF.
Correcting total allocated size in attribute record (80, "")
of file 40000000001AF.
Deleted corrupt attribute list entry
with type code 80 in file 1AF.
Deleting corrupt attribute record (0x80, "")
from file record segment 0x1AF.
Deleting corrupt attribute record (0x80, "")
from file record segment 0x9285.
Deleting corrupt attribute record (0x80, "")
from file record segment 0xBF44.
Deleting corrupt attribute record (0x80, "")
from file record segment 0xBF4B.
Deleted corrupt attribute list entry
with type code 80 in file 1B6.
Deleted corrupt attribute list entry
with type code 80 in file 1B6.
Deleting corrupt attribute record (0x80, "")
from file record segment 0x1B6.
Deleting corrupt attribute record (0x80, "")
from file record segment 0xBF31.
Deleted corrupt attribute list entry
with type code 80 in file 1C1.
Deleted corrupt attribute list entry
with type code 80 in file 1C1.
Deleted corrupt attribute list entry
with type code 80 in file 1C1.
Correcting total allocated size in attribute record (80, "")
of file 40000000001C1.
Deleted corrupt attribute list entry
with type code 80 in file 1C1.
Deleting corrupt attribute record (0x80, "")
from file record segment 0x1C1.
Deleting corrupt attribute record (0x80, "")
from file record segment 0xBF2F.
Deleting corrupt attribute record (0x80, "")
from file record segment 0xBF45.
Deleting corrupt attribute record (0x80, "")
from file record segment 0xBF4A.
Deleted corrupt attribute list entry
with type code 80 in file 1E7.
Deleted corrupt attribute list entry
with type code 80 in file 1E7.
Deleting corrupt attribute record (0x80, "")
from file record segment 0x1E7.
Deleting corrupt attribute record (0x80, "")
from file record segment 0xBF41.
Deleted corrupt attribute list entry
with type code 80 in file 1EB.
Deleted corrupt attribute list entry
with type code 80 in file 1EB.
Deleted corrupt attribute list entry
with type code 80 in file 1EB.
Correcting total allocated size in attribute record (80, "")
of file 40000000001EB.
Deleted corrupt attribute list entry
with type code 80 in file 1EB.
Deleting corrupt attribute record (0x80, "")
from file record segment 0x1EB.
Deleting corrupt attribute record (0x80, "")
from file record segment 0xBF2E.
Deleting corrupt attribute record (0x80, "")
from file record segment 0xBF43.
Deleting corrupt attribute record (0x80, "")
from file record segment 0xBF49.
Deleted corrupt attribute list entry
with type code 80 in file 1F5.
Deleted corrupt attribute list entry
with type code 80 in file 1F5.
Deleting corrupt attribute record (0x80, "")
from file record segment 0x1F5.
Deleting corrupt attribute record (0x80, "")
from file record segment 0x14D.
Deleted corrupt attribute list entry
with type code 80 in file 208.
Deleted corrupt attribute list entry
with type code 80 in file 208.
Deleting corrupt attribute record (0x80, "")
from file record segment 0x208.
Deleting corrupt attribute record (0x80, "")
from file record segment 0xBF3A.
Deleted corrupt attribute list entry
with type code 80 in file 92E1.
Deleted corrupt attribute list entry
with type code 80 in file 92E1.
Deleting corrupt attribute record (0x80, "")
from file record segment 0x92E1.
Deleting corrupt attribute record (0x80, "")
from file record segment 0xBF3D.
Deleted corrupt attribute list entry
with type code 80 in file 92EA.
Deleted corrupt attribute list entry
with type code 80 in file 92EA.
Deleting corrupt attribute record (0x80, "")
from file record segment 0x92EA.
Deleting corrupt attribute record (0x80, "")
from file record segment 0xBF3E.
Deleted corrupt attribute list entry
with type code 80 in file 930E.
Deleted corrupt attribute list entry
with type code 80 in file 930E.
Deleted corrupt attribute list entry
with type code 80 in file 930E.
Correcting total allocated size in attribute record (80, "")
of file 300000000930E.
Deleted corrupt attribute list entry
with type code 80 in file 930E.
Deleting corrupt attribute record (0x80, "")
from file record segment 0x930E.
Deleting corrupt attribute record (0x80, "")
from file record segment 0xBF1F.
Deleting corrupt attribute record (0x80, "")
from file record segment 0xBF42.
Deleting corrupt attribute record (0x80, "")
from file record segment 0xBF4C.
  48977 file records processed.
File verification completed.
 Phase duration (File record verification): 15.66 seconds.
Deleting orphan file record segment 14D.
  145 large file records processed.
 Phase duration (Orphan file record recovery): 1.45 milliseconds.
  0 bad file records processed.
 Phase duration (Bad file record checking): 0.33 milliseconds.

Stage 2: Examining file name linkage ...
Correcting sparse file record segment 308.
Correcting sparse file record segment 431.
Correcting sparse file record segment 449.
Correcting sparse file record segment 491.
Correcting sparse file record segment 37646.
  7 reparse records processed.
  51729 index entries processed.
Index verification completed.
 Phase duration (Index verification): 18.40 seconds.
  0 unindexed files scanned.
 Phase duration (Orphan reconnection): 6.93 milliseconds.
  0 unindexed files recovered to lost and found.
 Phase duration (Orphan recovery to lost and found): 1.94 milliseconds.
  7 reparse records processed.
 Phase duration (Reparse point and Object ID verification): 3.57 milliseconds.

Stage 3: Examining security descriptors ...
Security descriptor verification completed.
 Phase duration (Security descriptor verification): 45.51 milliseconds.
Inserting data attribute into file 134.
Inserting data attribute into file 14C.
Inserting data attribute into file 165.
Inserting data attribute into file 191.
Inserting data attribute into file 193.
Inserting data attribute into file 194.
Inserting data attribute into file 19F.
Inserting data attribute into file 1A7.
Inserting data attribute into file 1AF.
Inserting data attribute into file 1B6.
Inserting data attribute into file 1C1.
Inserting data attribute into file 1E7.
Inserting data attribute into file 1EB.
Inserting data attribute into file 1F5.
Inserting data attribute into file 208.
Inserting data attribute into file 92E1.
Inserting data attribute into file 92EA.
Inserting data attribute into file 930E.
  1395 data files processed.
 Phase duration (Data attribute verification): 4.17 milliseconds.
CHKDSK is verifying Usn Journal...
Usn Journal verification completed.
CHKDSK discovered free space marked as allocated in the
master file table (MFT) bitmap.
CHKDSK discovered free space marked as allocated in the volume bitmap.

Windows has made corrections to the file system.
No further action is required.

   3815317 MB total disk space.
   3543283 MB in 47406 files.
     15612 KB in 1378 indexes.
         0 KB in bad sectors.
    235231 KB in use by the system.
     65536 KB occupied by the log file.
 278312056 KB available on disk.

      4096 bytes in each allocation unit.
 976721407 total allocation units on disk.
  69578014 allocation units available on disk.
Total duration: 34.13 seconds (34139 ms).
  1. Open qBittorrent in Windows 11, and open the same .torrent without starting it. Then force-recheck to res-scan the pieces. Some files display "Errored: The handle is invalid"

Screenshot (553)

qbittorrent.log has the errors:

(W) 2023-08-02T18:13:09 - File error alert. Torrent: "music collection". File: "B:\music collection\song 1.wma". Reason: "music collection file_mmap (B:\music collection\song 1.wma) error: The handle is invalid"

Additional information

I have no clue if this is a problem of dislocker-fuse or mount -t ntfs.
It would require to test the NTFS drive again with and without BitLocker, and check if there's some dmesg error (which I didn't).

Can anybody help debug this issue?

@superbonaci
Copy link
Author

I think this issue could have been caused due to shutting down the machine while qBittorrent was pre-allocating some files in the NTFS drive, but not sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant