mkfatfs, filesystem tool
========================

Here is the first public release of mkfatfs, a filesystem creation tool.
The main reason for this programm was to make possible to build TOS and DOS FAT32 partitions also on ATARI computers.

Sorry, it's a command line tool. Contact me if you want to write
a GEM interface.

Ok, what is FAT32, you ask?

FAT32 is an extension of the existing FAT definition. The FAT (File
Allocation Table) entry on existing partitions is 16 bit wide.
This limits the maximum number of clusters to 65536 (under TOS
to 32768 because of some bugs). So if you need large partitions
you must increase the cluster size. But this has a negative side effect.
Large cluster also increase lost space (remember, every file need
at least one cluster). Example: if you have a 1 GB partition your
cluster size is 32 kB. If a file is something like 1000 bytes long
you loss 32 - 1 = 31 kb space. If you have a lot of small files
(html documents for example) you loss a lot of harddisk space. With FAT32
you can reduce the cluster size on large partitions. The only disadvantage
is that FATs may become large.


Requirements:

- for FAT32: HDDriver 7.55 or any other that support DOS 0xb and TOS 'F32'
  partitions

- XHDI level 1.10 (for normal FAT partitions)


Note: it doesn't work with floppies at the moment


Usage:

mkfatfs detects the partition ID automatically. The partition ID is found
in the partition table (root sector) but isn't read directly. A XHDI
function is used. The partition ID is very important. It describes the type
of the filesystem on the partition.

TOS IDs: GEM/BGM - GEMDOS compatible partitions
         F32     - FAT32 compatible partitions on ATARI

DOS IDs: 0x6     - DOS compatible partitions
         0xb     - FAT32 compatible partitions (WinNT, Win98)

mkfatfs checks the partition ID it found on the partition and checks it with
type of filesystem that will be created. If the partition ID does not match,
mkfatfs return an error message and terminate. If the filesystem type to be
created isn't specified, mkfatfs will create a filesystem that matches the
partition ID. If the partition ID is completly unknown, you get always
a error message.

Example: you have a GEM/BGM partition and will change it into a FAT32
partition. You must change first the partition ID to 'F32' otherwise
a new normal GEM/BGM partition is created. The partition ID can be
easily changed with HDDriver. See documentation for more details.
Then you can start mkfatfs. Mkfatfs detects the partition ID and
creates a FAT32 partition by default.

Don't be angry. Before any data is written, all calculated values of the new filesystem will be printed first, then you will be asked if
you really wanna do this.


Options:

If you want to control all the parameters of the new filesystem, read the following paragraph. Normally the default values are good enough. If you doesn't know what a FAT is, skip this paragraph.

You must always specify a drive on which the filesystem will be created.

If you start mkfatfs without any parameter, you get the
following output:
------------------------------------------------------------------------------
./mkfatfs 0.2b, 1998-08-01 for TOS and DOS FAT/FAT32-FS
Found XHDI level 1.30.

No drive specified.

Usage: ./mkfatfs [OPTIONS] drv:
  -c            Check filesystem as is gets built
  -f <num>      Number of FATs (between 1 and 4)
  -F <num>      FAT size (12, 16, or 32)
  -i <id>       Volume ID as hexadecimal number (i.e. 0x0410)
  -l <filename> Bad block filename
  -m <filename> Boot message filename--text is used as a boot message
  -n <name>     Volume name
  -r <num>      Root directory entries (not applicable to FAT32)
  -s <num>      Sectors per cluster (2, 4, 8, 16, 32, 64, or 128)
  -a            Create filesystem always (disables partition ID checking)
------------------------------------------------------------------------------

-c      perform a bad block check (takes some time); mark all found bad              blocks in the FAT as used

-f      allows you to specify the number of FATs (available on FAT32)

-F      specifiy type of FAT: FAT12 (disks), FAT16 (normal), FAT32         (extended)

-i      the volume ID on DOS partitions; has nothing todo with partition ID;
        default is the time of creation

-l      specify a file with a bad block list; the bad blocks are marked
        in the FAT as used

-m      specify bootmessage on DOS disks;
        default is: "Please insert a bootable disk ..." blah, blah.

-n      also only interest for DOS partitions; 12 byte name for partition

-r      specify the number of root directory entries; root dir size is fixed
        on normal FAT partitions; not needed for FAT32 (dynamic root dir)

-s      specify the cluster size; a sector is normally 512 bytes long;
        otherwise cluster size will be automatically calculated for FAT12 and         FAT16;
        for FAT32 the default cluster size is 4 kb (8 sectors per cluster)

-a      disable partition ID checking; akways create filesystem
