CHKDSK Breaks NTFS permission

Last modified by Victor Zhang on 02:10, 09/05/2021

After a chkdsk /r /f /v, the chkdsk messed a lot of folder permissions.

The first to notice is OneDrive and Google Drive

The GUI of windows explorer is not capable of reclaiming ownership of folder, which led me to delete the folder in Administrator CMD (Terminal) and re-syncing them. It took a while until I realised it was the wrong approach.

If admin terminal can access them, the files are actually not corrupt. After a bit more searching, I found that using admin terminal is able to reset NTFS previliage. Reason being a lot of other software  installations were broken, as I can't reinstall them and lose all the settings.

Reset NTFS privilage
ICACLS <directory> /T /Q /C /RESET

In the Command:

/T : indicates that this operation is performed on all matching files/directories below the directories specified in the name.
/Q: indicates that icacls should suppress success messages.
/C: indicates that this operation will continue on all file errors. Error messages will still be displayed.
/RESET: resets the previliage

Reference: How to reset NTFS permissions with ICACLS

Tags:
Created by Victor Zhang on 02:02, 09/05/2021