[comp.sys.atari.st] 2K of disk space lost?

andrew@uxm.sm.ucl.ac.UK (Andrew Dawson) (03/22/89)

If I format a disk double sided from the desktop, it will have 80
tracks of 9 sectors. One of these is the boot sector, and there are 2
copies of the Fat Allocation Table (5 sectors each) and a root
directory (7 sectors).

Now, 2*80*9-1-2*5-7 = 1422, and at 512 bytes per sector this is
728064 bytes. However, after formatting is complete (assuming no bad
sectors), I am told that the disk has 726016 bytes free. 2K is
unaccounted for.

Also, if I format a 720K disk on an MS-DOS machine, DOS reports 730112
bytes free (a FAT is only 3 sectors under DOS). If I take this same blank
disk and put it in my ST, a "show info" reports 728064 bytes free - another
error of 2048 bytes.

A Dfree() call on a TOS formatted disk suggests that the disk has 711
clusters of which 709 are free (yet again suggesting that 2K has been
used). I know that cluster numbers start at 2, but this isn't "used"
space.

Is this a TOS bug, or have I missed something? Anyone got any ideas?



Andrew Dawson
School Of Medicine Computer Unit
University College London

root@yale.UUCP (Celray Stalk) (03/23/89)

In article <8903211617.AA27122@uk.ac.ucl.sm.uxm> andrew@uxm.sm.ucl.ac.UK (Andrew Dawson)
writes:
>Is this a TOS bug, or have I missed something? Anyone got any ideas?

Yes, this is a known TOS bug.  The last two clusters of every disk
remain unused.  Apparently they can be read if a file happens to be
there, but when looking for free space to write a file, TOS doesn't
know of their existence.  Allan Pratt posted a note awhile back giving
an improbable scenario in which problems might be caused if a user of
an old TOS tried to write to a nearly full disk that had been created
by a fixed TOS.  Thus, last I heard, Atari had decided *not* to fix the
problem in TOS 1.4.
==================================================
| Michael Fischer                                |
|    Arpanet:    <fischer-michael@cs.yale.edu>   |
|    Bitnet:     <fischer-michael@yalecs.bitnet> |
|    UUCP:       <fischer-michael@yale.UUCP>     |
==================================================

hcj@lzaz.ATT.COM (H.JOHNSON) (03/23/89)

In article <8903211617.AA27122@uk.ac.ucl.sm.uxm>, andrew@uxm.sm.ucl.ac.UK (Andrew Dawson) writes:
> If I format a disk double sided from the desktop, it will have ...
>  2K is
> unaccounted for.
> 
This was discussed at length relative to TOS 1.4.  Yes its a bug.
Yes 1.4 will continue the bug, because not doing so will be
[confusing|dangerous]. Pick one.
Be glad the rest of the sectors are there all the time! Ha Ha.

Howard C. Johnson
ATT Bell Labs
att!lzaz!hcj
hcj@lzaz.att.com

neil@cs.hw.ac.uk (Neil Forsyth) (03/23/89)

In article <8903211617.AA27122@uk.ac.ucl.sm.uxm> andrew@uxm.sm.ucl.ac.UK (Andrew Dawson) writes:
>... 728064 bytes. However, after formatting is complete (assuming no bad
>sectors), I am told that the disk has 726016 bytes free. 2K is
>unaccounted for.
...
>Is this a TOS bug, or have I missed something? Anyone got any ideas?

Yes, it is a bug. Atari won't fix it because of the compatibility problems
with old systems that would still have it. I still wish that Atari would fix
it though. I would also like to see the desktop diskcopy function copy disks
with 10 sectors per track.

My disk formatter (AFMT) uses 3 SPF on double sided disk and 2 SPF on single
sided. At 80 tracks and 10 sectors per track that gives 809984 bytes free.

>Andrew Dawson
>School Of Medicine Computer Unit
>University College London


 _____________________________________________________________________________
/ DISCLAIMER: Unless otherwise stated, the above comments are entirely my own \
!                                                                             !
! "I think all right thinking people in this country are sick and tired of    !
! being told that ordinary decent people are fed up in this country with      !
! being sick and tired. I'm certainly not and I'm sick and tired of being     !
! told that I am!" - Monty Python                                             !
!                                                                             !
! Neil Forsyth                           JANET:  neil@uk.ac.hw.cs             !
! Dept. of Computer Science              ARPA:   neil@cs.hw.ac.uk             !
! Heriot-Watt University                 UUCP:   ..!ukc!cs.hw.ac.uk!neil      !
! Edinburgh                                                                   !
! Scotland                                                                    !
\_____________________________________________________________________________/

bdeskin@cognos.uucp (Bob Deskin) (03/23/89)

In article <8903211617.AA27122@uk.ac.ucl.sm.uxm> andrew@uxm.sm.ucl.ac.UK (Andrew Dawson) writes:
>If I format a disk double sided from the desktop, it will have 80
>tracks of 9 sectors. One of these is the boot sector, and there are 2
>copies of the Fat Allocation Table (5 sectors each) and a root
>directory (7 sectors).
>
--> interesting stuff deletedd
>
>A Dfree() call on a TOS formatted disk suggests that the disk has 711
>clusters of which 709 are free (yet again suggesting that 2K has been
>used). I know that cluster numbers start at 2, but this isn't "used"
>space.
>
>Is this a TOS bug, or have I missed something? Anyone got any ideas?

This is in fact a TOS bug or more specifically GEMDOS if I recall. The
operating system "forgets" about the last two clusters on the disk. I have 
formatted a disk, written a series of 2K files, and sure enough the last
two clusters cannot be written to. A while back I posted the same question
as you just did to the net and got a response from Atari itself (I forget
who, sorry). They had thought of fixing it but the incompatibility 
between old and new versions would create too many problems. Looks like
we're stuck with it. 



-- 
Bob Deskin                             Cognos Incorporated   
(613) 738-1338 ext 5003                P.O. Box 9707
FAX (613) 738-0002                     3755 Riverside Drive
UUCP: uunet!mitel!sce!cognos!bdeskin   Ottawa, Ontario, CANADA  K1G 3Z4

dlm@druwy.ATT.COM (Dan Moore) (03/24/89)

in article <8903211617.AA27122@uk.ac.ucl.sm.uxm>, andrew@uxm.sm.ucl.ac.UK
(Andrew Dawson) says:
> Now, 2*80*9-1-2*5-7 = 1422, and at 512 bytes per sector this is
> 728064 bytes. However, after formatting is complete (assuming no bad
> sectors), I am told that the disk has 726016 bytes free. 2K is
> unaccounted for.
> 
> Also, if I format a 720K disk on an MS-DOS machine, DOS reports 730112
> bytes free (a FAT is only 3 sectors under DOS). If I take this same blank
> disk and put it in my ST, a "show info" reports 728064 bytes free - another
> error of 2048 bytes.

	This is a known bug in TOS.  TOS never uses the last two
clusters on any disk (including hard disks).  TOS can read files that
include those two clusters it just won't use them when writing to the
disk.  This means that TOS floppies are 4K smaller than a floppy
formated with MSDOS, 2K is lost to overly large FATs and 2K lost in the
"missing" clusters at the end of the disk.


	It seems that Atari doesn't consider the missing 2 clusters to
be important, they (Alan Pratt) have stated that the bug will not be
fixed in TOS 1.4. 




				Dan Moore
				AT&T Bell Labs
				Denver
				dlm@druwy.ATT.COM
				dlm@druhi.ATT.COM

kbad@atari.UUCP (Ken Badertscher) (03/27/89)

In article <2228@brahma.cs.hw.ac.uk> neil@cs.hw.ac.uk (Neil Forsyth) writes:
| [...] I would also like to see the desktop diskcopy function copy disks
|with 10 sectors per track.
 
  The TOS 1.4 Desktop will copy arbitrary format disks.  As long as you
feed it a destination disk with the same format as the source, no problem.
 

-- 
 Ken Badertscher                 | #include <disclaimer>
 Atari R&D Software Engine       | GEMDOS LIVES! ...or is that Frodo?
 {portal,ames,imagen}!atari!kbad | I can never remember these things...

dag@per2.UUCP (Daniel A. Glasser) (04/04/89)

In article <54471@yale-celray.yale.UUCP>, root@yale.UUCP (Celray Stalk) writes:
> In article <8903211617.AA27122@uk.ac.ucl.sm.uxm> andrew@uxm.sm.ucl.ac.UK (Andrew Dawson)
> writes:
> >Is this a TOS bug, or have I missed something? Anyone got any ideas?
> 
> Yes, this is a known TOS bug.  The last two clusters of every disk
> remain unused. [...]
> [...]  Thus, last I heard, Atari had decided *not* to fix the
> problem in TOS 1.4.
> ==================================================
> | Michael Fischer                                |
> ==================================================

Back in mid-1986, I wrote a RAM-disk utility at Mark Williams Co., which
became the basis for the RDY utility (I did not write RDY, that was done
by Roger, who is still working for MWC).  I was aware of this bug in the
TOS cluster allocation scheme, and built a fix into the FAT initialization
code in the non-resident part of the program.  This involved telling the
OS that there were two extra clusters (in the disk configuration in block 0)
and marking the last two clusters as bad in the FAT.  The OS would never
try and access these clusters, since they were "known" to be bad, and the
buggy OS code would have no trouble allocating the last two real clusters
because the bug is in the determination of which FAT entry corresponds to
which cluster on allocation only.  I don't remember if I ever tried this
on a floppy, I know I never tried it on a hard drive.  It is my belief,
however, that the kluge will work and won't break on a fixed OS.
The source for RDY includes this hack as an option.  If you have the MWC
package, you may want to look into the source.  If you want more details,
send me mail.  I don't have my ST here at my office, so I can't give any
real details right now.

I hope this helps someone.  Alan -- What's your opinion of this hack?
Any problems that I missed?  Also, a question about TOS 1.4 -- Can
it handle cluster sizes != 2 sectors?

						Daniel A. Glasser
-- 
 _____________________________________________________________________________
    Daniel A. Glasser                           One of those things that goes
    uwvax!per2!dag                              "BUMP!!!(ouch)" in the night. 
 ---Persoft, Inc.---------465 Science Drive-------Madison, WI 53711-----------

neil@cs.hw.ac.uk (Neil Forsyth) (04/06/89)

In article <837@per2.UUCP> dag@per2.UUCP (Daniel A. Glasser) writes:
>This involved telling the
>OS that there were two extra clusters (in the disk configuration in block 0)
>and marking the last two clusters as bad in the FAT.  The OS would never
>try and access these clusters, since they were "known" to be bad, and the
>buggy OS code would have no trouble allocating the last two real clusters
>because the bug is in the determination of which FAT entry corresponds to
>which cluster on allocation only.  I don't remember if I ever tried this
>on a floppy, I know I never tried it on a hard drive.  It is my belief,
>however, that the kluge will work and won't break on a fixed OS.
...
>I hope this helps someone.  Alan -- What's your opinion of this hack?
>Any problems that I missed?  Also, a question about TOS 1.4 -- Can
>it handle cluster sizes != 2 sectors?

Yes it does work on a floppy and no I'm not going to do it on a hard drive.
Since Allan said I would get away with this, I'm going to put it in the next
version of AMFT. 812032 bytes free and still only 80 tracks!


>
>						Daniel A. Glasser
>-- 
> _____________________________________________________________________________
>    Daniel A. Glasser                           One of those things that goes
>    uwvax!per2!dag                              "BUMP!!!(ouch)" in the night. 
> ---Persoft, Inc.---------465 Science Drive-------Madison, WI 53711-----------


 _____________________________________________________________________________
/ DISCLAIMER: Unless otherwise stated, the above comments are entirely my own \
!                                                                             !
! "I think all right thinking people in this country are sick and tired of    !
! being told that ordinary decent people are fed up in this country with      !
! being sick and tired. I'm certainly not and I'm sick and tired of being     !
! told that I am!" - Monty Python                                             !
!                                                                             !
! Neil Forsyth                           JANET:  neil@uk.ac.hw.cs             !
! Dept. of Computer Science              ARPA:   neil@cs.hw.ac.uk             !
! Heriot-Watt University                 UUCP:   ..!ukc!cs.hw.ac.uk!neil      !
! Edinburgh                                                                   !
! Scotland                                                                    !
\_____________________________________________________________________________/