[net.micro.pc] Symbolic link under MS-DOS ??!!??

guido@boring.UUCP (01/22/85)

Much to my surprise, I seem to have created a symbolic link on my MS-DOS
hard disk!  The problem is, since symbolic links are undocumented, I don't
know how to get rid of it.

What actually happened is this: I decided to move some stuff to a lower
directory in the hierarchy, and wanted to create a directory named 'old':
	C> mkdir old
After a second or two, the whole screen turned to dots (the graphic displayed
for ^G, probably), nicely blinking as if I had trapped some alarm.
Shift-break nor Ctrl-Alt-Del would help me out, so I switched the power
off and on.  Back in the directory where I tried to do the mkdir, I found
that there was a directory named 'old'.  Guess my surprise when I found that
it contained some files, and at close inspection had exactly the same lay-out
as my root (\) directory!  Well, after
	C> cd old
	C> cd
	C:\
	C>
I concluded that 'old' was actually the same as root.  I have found no other
strange circumstances, but now I am puzzled by two questions:
	- what happened exactly
	- how to get rid of this directory!
Rmdir of course won't work, because the directory isn't empty.
I haven't got any utilities to tackle the disk.

Note added in proof: the chkdsk program seems to have trouble with my hard
disk -- it sits there reading and working, and never ever outputs a thing.

Any help would be appreciated.  I run an IBM-PC with expansion box with an
IBM 10Mb hard disk drive, and MS-DOS 2.0.

	Guido van Rossum, CWI, Amsterdam
	mcvax!guido

johna@haddock.UUCP (01/26/85)

You have created a directory entry containing just an 8 byte name, 3 byte
extension, 1 byte attribute (10H) and all the rest of the fields are zeros.
Zero in bytes 26-27 (the starting cluster of a file/directory) indicates
the root, as it does in directory entries . and .. (dot & dotdot).

I know of no way to remove this entry without a disk editor or
  GASP!! reformatting.

			!decvax!ima!haddock!johna (John Adams)

broehl@wateng.UUCP (Bernie Roehl) (01/28/85)

Actually, you don't need a disk editor; you can do it with DEBUG.
It's a little tedious, however; since it's a directory, you can't simply
edit it.  Assuming the offending directory is under root, you can find
its entry in the root directory by just prowling through the first few
sectors of the disk, then patch the necessary bytes and write the root
directory sectors out again.  In particular, you can change it from a
directory to an ordinary file, so you can erase it.

The reason chkdsk hangs is that it recursively walks the directory
hierarchy, and since that hierarchy now contains itself, chkdsk never
terminates.

I would stronly sugest backing up the disk before attempting to edit the
directory using DEBUG, especially if you have little or no previous
experience in that area.  Of course, if you're going to back it all up
anyway, why not just reformat and restore everything but the bad directory
entry?

I can't predict how BACKUP will respond to your funny directory; the
simplest work-around is to backup everything *but* that directory, so that
it's never stored on the backup diskettes (also makes the restore a lot
easier).

Best of luck!
					--Bernie Roehl
 
-- 
        -Bernie Roehl    (University of Waterloo)
	...decvax!watmath!wateng!broehl

jchapman@watcgl.UUCP (john chapman) (01/28/85)

> You have created a directory entry containing just an 8 byte name, 3 byte
> extension, 1 byte attribute (10H) and all the rest of the fields are zeros.
> Zero in bytes 26-27 (the starting cluster of a file/directory) indicates
> the root, as it does in directory entries . and .. (dot & dotdot).
> 
> I know of no way to remove this entry without a disk editor or
>   GASP!! reformatting.
 DEBUG will let you do this (access blocks on the disk)
 e.g.
 l 0 100,2,5
loads 5 sectors starting at sector 2 from drive 0 (a:) to location
100 (all numbers are hex). the w command writes them back out.  These
are physical device sectors (i.e. not necessarily 512 bytes).  I      
repaired my root (after doing a RECOVER which supposedly recovers bad
blocks but which actuall converted all my files *and* directories to
simple files of the form FILEnnnn.CHK until root dir ran out of space)
and while it was tedious it works.

bmw@aesat.UUCP (Bruce Walker) (01/29/85)

In article <322@haddock.UUCP> johna@haddock.UUCP writes:
>You have created a directory entry containing just an 8 byte name, 3 byte
>extension, 1 byte attribute (10H) and all the rest of the fields are zeros.
>Zero in bytes 26-27 (the starting cluster of a file/directory) indicates
>the root, as it does in directory entries . and .. (dot & dotdot).
>
>I know of no way to remove this entry without a disk editor or
>  GASP!! reformatting.
>
>			!decvax!ima!haddock!johna (John Adams)

Actually, DEBUG makes a pretty good (read "cheap") disk editor.  Check out the
commands "Load" and "Write" and you will find that you may specify particular
sectors or blocks of sectors to read/write into/from memory.  In memory, they
may be examined and modified with the "Display" and "Enter" commands.  In this
fashion, one may edit the actual directory area (just stuff a 0xE5 into the
first byte of the entry to eliminate, and update the on-disk copy. *BEWARE*,
though, this process is not for the inexperienced or faint-of-heart, patching
directories of live disks is not unlike open-heart surgery: one slip and
*SzzzzzxxxK!* (slicing motion of hand across throat).

Bruce Walker     {allegra,ihnp4,linus,decvax}!utzoo!aesat!bmw