Newsgroups: comp.os.msdos.misc
Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!linus!linus!mwunix.mitre.org!jcmorris
From: jcmorris@mwunix.mitre.org (Joe Morris)
Subject: Re: Cross Linked Clusters?
Message-ID: <jcmorris.674834813@mwunix.mitre.org>
Keywords: chkdsk, cross linked clusters
Sender: news@linus.mitre.org (News Service)
Nntp-Posting-Host: mwunix.mitre.org
Organization: The MITRE Corporation, Bedford MA
References: <49299@ut-emx.uucp>
Distribution: usa
Date: 21 May 91 14:06:53 GMT

gcoen@emx.utexas.edu (Gary A. Coen) writes:

>Running Windows 3.0 on an IBM PS2 Model 80 (6Mb RAM, 44.5Mb FD, PCDOS 3.3),
>when invoking the CHKDSK function with the /F parameter set, I get the fol-
>lowing behavior:

>	CHKDSK /F

>	Volume is ...
>	File A is cross linked on cluster n.
>	File B is cross linked on cluster n.

>I have not been able to find documentation of this in my DOS manual.  Is it
>bad?  Does anyone *know* what it means?  Does anyone *know* why it is happen-
>ing?

What it's telling you is that both files A and B are claiming that cluster -n-
contains their data.  This cannot occur in a properly-running system.  At
least one of the two files is corrupted, and possibly both.

The DOS file system works (if you want to call it that) by using the
directory entry for a file to point to the first cluster containing
the data.  When someone wants to get the data from the next cluster, the
file system goes to the FAT (File Allocation Table) entry for the first
cluster; that entry should be either an EOF (End-of-File) mark, or
a pointer to the second cluster of data.  The process continues until
the user either gives up (e.g., by reading a ^Z in a text file) or the
get-next-cluster routine encounters an EOF mark in the FAT.

*Every* cluster in the data portion of a disk (fixed or floppy) is
represented by a FAT entry.  The entry can say that the cluster is:

  (a) Unused, and not allocated to any file
  (b) In use by a file, and the FAT entry points to the next cluster, 
  (c) In use by a file, and is the last cluster for that file, or
  (d) unusable because of a disk error.

What CHKDSK does is to build a map in memory of all of the clusters on
the disk.  It strikes out the clusters which are marked free in the FAT,
and then runs through all the directories on the disk, and strikes out
the clusters owned by each file by running the FAT chain.  The disk is
OK if at the end of the process each cluster has been struck out exactly
once.  (Yes, CHKDSK also matches the file size against the cluster count...
but that wasn't the question.)

An error is reported if either (a) a cluster was not struck out during
the process, or (b) a cluster was struck twice.

If a cluster was not struck out, then you get a "lost chain" error message.
If a cluster was struck more than once (as you saw) then two or more files
are claiming ownership of the cluster.

The CHKDSK function has nothing to do with Windows, although it may have
been a Windows program (or crash) which contaminated the disk.  Best idea
would be to restore the files from your backup disks.

Joe
