@CHIP-RTOS - CHKDSK Shell Command Operation
IPC@CHIP® Documentation Index
CHKDSK
The primary function of the
CHKDSK command
is to survey the disk's File Allocation Table (FAT) to determine if any
clusters are allocated which do not belong to any file or directory.
Such clusters are considered "lost". Lost clusters can result from
power being lost at the moment a file or directory was being updated
on the disk.
When CHKDSK is used with the /F command line option, the FAT entries
for lost clusters will be marked free to restore them to the disk's
available free space.
Assuming that no critical errors (e.g. "File system resources not available")
occur during the CHKDSK operation, a count of lost and bad sectors will be
reported to the console upon completion of the scan. For large drives, this
scan may require some significant time. The demand for
system memory can be high
for large drives with a high number of clusters (requirement: 1 byte
per 8 clusters).
The CHKDSK scan also checks for various other fault conditions within
the disk's FAT. The following set of messages may appear if any of
these unlikely faults are detected.
Invalid cluster numbers:
FAT entries must be either particular flag values or
reference an existing cluster number. This is the number of cluster
numbers read from the FAT which were neither. When the /F command line
option is used, these FAT entries will be changed to terminate the
respective file's cluster chain at this point.
Corrupt long file names (LFN):
Long file names are stored in directories over multiple directory entries
preceding the entry for which a long name applies. For each file
(or directory) found whose long file name was corrupt, this count will
be incremented. When the /F command line option is used, these LFN
nodes will be deleted. The corresponding file then will only have
its short 8.3 alias name to go by.
Bad LFN DIR nodes:
This is the number of long file name entries which were invalid. When
the /F command line option is used, these LFN nodes will be marked as
deleted.
Invalid . or .. directory entry:
This count is incremented each time a . directory node does not reference
that directories own first cluster or when the .. directory entry does not
reference the parent directory's first cluster In either case, when the /F
command line option is used, these link nodes will be corrected to reference
the proper cluster.
If any of the following unexpected errors is reported, then a disk
reformat
is recommended. (The CHKDSK /F command line option does not remedy these
faults.)
The . or .. directory entry repeated:
Each directory must have at most one self (.) reference and one parent
directory (..) reference. This error count is incremented when ever
multiple occurrences of either of these special directory link nodes is
seen.
Clusters in more than a single chain:
This is the number of times where a FAT entry references a cluster which
has already been referenced by some other FAT entry. This is an illegal
condition.
Directory depth limit exceeded:
This is the number of times that the subdirectory depth exceeded the
limit placed on the file system by the maximum path string length limit
of 260 characters. This error being detected is highly unlikely.
It will cause the remainder of the CHKDSK operation to be incomplete.
Infinite loop in file's cluster chain:
This count is incremented for each file encountered which had a cluster
chain which closed on itself.
End of document
|