DETERMINING HARD DISK ALLOCATION                       

      DOS determines disk allocation using the following formula:

                                    D * BPD
                       TS - RS -  ***********
                                      BPS
                 SPF = ******************************
                                   BPS * SPC
                            CF + **************
                                      BPC

       where:

            TS   total sectors on disk
            RS   the number of sectors at the beginning of the disk that
                 are  reserved  for  the  boot  record.  DOS  reserves 1
                 sector.
            D    tThe number of directory entries in the root directory.
            BPD  the number of bytes per directory entry. This is always
                 32.
            BPS  the number of bytes per logical sector.  Typically 512,
                 but you can specify a different number with VDISK.
            CF   the number of FATS per disk. Usually 2. VDISK is 1.
            SPF  the number of sectors per FAT. Maximum 64.
            SPC  the number of sectors per allocation unit.
            BPC  the number of bytes per FAT entry. BPC is  1.5  for  12
                 bit FATs. 2 for 16 bit FATS.

     To calculate the minimum partition size that will force a 16-bit FAT:

               CYL = (max clusters * 8)/(HEADS * SPT)

       where:

            CYL            number of cylinders on the disk
            max clusters   4092 (maximum for a 12 bit FAT)
            HEADS          number of heads on the hard disk
            SPT            sectors per track  (normally 17 on MFM)

   Notes:  * DOS 2.0 uses a "first  fit"  algorithm  when allocating
             file space on  the  hard disk. Each time an application
             requests disk space, it will scan from the beginning of
             the FAT until it  finds  a  contiguous piece of storage
             large enough for the file.

           * DOS 3.0 keeps a pointer into the disk space, and begins
             its  search  from  the  point  it last left  off.  This
             pointer is lost when  the  system  is rebooted. This is
             called the  "next fit" algorithm. It is faster than the
             first fit and helps minimise fragmentation.

           * In  either case, if the FCB  function  calls  are  used
             instead of  the handle function calls, the file will be
             broken into pieces starting  with  the  first available
             space on the disk.


Copyright © 1985 to 2022 Beta Systems                            Last modified: Wednesday, January 05, 2022 .