Discussion:
shortest FAT32
(too old to reply)
wolfgang kern
2024-03-18 07:57:20 UTC
Permalink
I'm still busy with manual creation of UEFI-GPT conform environment.

my idea is to make the first partition FAT32, but as small as possible.
because M$-FAT are defined by number of clusters rather then else my
only choice will be to set cluster-size to one sector
[65525 sectors] I need only 512 MB for my OS boot section, what a waste.

are there other ways to shorten a FAT32 w/o breaking too many rules ?
perhaps by write the first 8 bytes of the FAT ?
__
wolfgang
Kerr-Mudd, John
2024-03-18 09:10:06 UTC
Permalink
On Mon, 18 Mar 2024 08:57:20 +0100
Post by wolfgang kern
I'm still busy with manual creation of UEFI-GPT conform environment.
my idea is to make the first partition FAT32, but as small as possible.
because M$-FAT are defined by number of clusters rather then else my
only choice will be to set cluster-size to one sector
[65525 sectors] I need only 512 MB for my OS boot section, what a waste.
512MB seems quite a lot!
Post by wolfgang kern
are there other ways to shorten a FAT32 w/o breaking too many rules ?
perhaps by write the first 8 bytes of the FAT ?
__
wolfgang
Dunno; I've not been there; I've just replaced boot sectors to kill the
Stone virus.
--
Bah, and indeed Humbug.
wolfgang kern
2024-03-18 10:32:12 UTC
Permalink
Post by Kerr-Mudd, John
Post by wolfgang kern
I'm still busy with manual creation of UEFI-GPT conform environment.
my idea is to make the first partition FAT32, but as small as possible.
because M$-FAT are defined by number of clusters rather then else my
only choice will be to set cluster-size to one sector
[65525 sectors] I need only 512 MB for my OS boot section, what a waste.
512MB seems quite a lot!
Yeah, it should read 512 KB :)
it later deploys itself depending on included features to 4..64 MB.
Post by Kerr-Mudd, John
Post by wolfgang kern
are there other ways to shorten a FAT32 w/o breaking too many rules ?
perhaps by write the first 8 bytes of the FAT ?
Dunno; I've not been there; I've just replaced boot sectors to kill the
Stone virus.
__
wolfgang
JJ
2024-03-18 10:42:13 UTC
Permalink
Post by wolfgang kern
I'm still busy with manual creation of UEFI-GPT conform environment.
my idea is to make the first partition FAT32, but as small as possible.
because M$-FAT are defined by number of clusters rather then else my
only choice will be to set cluster-size to one sector
[65525 sectors] I need only 512 MB for my OS boot section, what a waste.
are there other ways to shorten a FAT32 w/o breaking too many rules ?
perhaps by write the first 8 bytes of the FAT ?
__
wolfgang
In at least Windows 7, it's 36MiB minimum for FAT-32.

Interrestingly irrelevant is that, exFAT can go as low as 1.44MB.
Mike Gonta
2024-03-18 14:04:48 UTC
Permalink
Post by wolfgang kern
I'm still busy with manual creation of UEFI-GPT conform environment.
my idea is to make the first partition FAT32, but as small as possible.
because M$-FAT are defined by number of clusters rather then else my
only choice will be to set cluster-size to one sector
[65525 sectors] I need only 512 MB for my OS boot section, what a waste.
are there other ways to shorten a FAT32 w/o breaking too many rules ?
perhaps by write the first 8 bytes of the FAT ?
__
wolfgang
This is a skeleton of my Fat32 Floppy Disk, (543 sector FAT32 file
system) for 1.44 MB floppy disk.
The trick I used was to mark the minimum FAT32 volume of 66602 outside
the 1.44 Mb as lost (0x0FFFFFF7) in the file allocation table.

[code]
VOLUME_LENGTH = 66602 ; minimum FAT32 volume = 32.5 MB
RESERVED_SECTORS = 21
BYTES_PER_SECTOR = 512
SECTORS_PER_CLUSTER = 1
PARTITION_OFFSET = 0
LABEL equ " " ; 11 characters maximum
BYTES_PER_CLUSTER = BYTES_PER_SECTOR*SECTORS_PER_CLUSTER
SECTORS_PER_FAT=((VOLUME_LENGTH-RESERVED_SECTORS)+(128*SECTORS_PER_CLUSTER-1))/(128*SECTORS_PER_CLUSTER)
START_OF_DATA = RESERVED_SECTORS+SECTORS_PER_FAT

org 0x7C00
boot_sector:
times 510-($-boot_sector) db 0
dw 0xAA55

fsi:
db "RRaA"
times 480 db 0
db "rrAa"
; number of free clusters
dd VOLUME_LENGTH-RESERVED_SECTORS-SECTORS_PER_FAT
dd 4 ; number of the next free cluster
times 12 db 0
dd 0xAA550000

times 7*512 db 0

upcase_table:
times 12*512 db 0

file_allocation_table:
dd 0xFFFFFFF8, 0xFFFFFFFF, 0x0FFFFFFF
times 2880-RESERVED_SECTORS-SECTORS_PER_FAT-1 dd 0
; mark sectors outside 1.44MB as lost
times VOLUME_LENGTH-2880 dd 0x0FFFFFF7
times SECTORS_PER_FAT*BYTES_PER_SECTOR-($-file_allocation_table) db 0

root: ; start of data
db LABEL
db 8 ; volume label
db 0
db HUNDREDTHS
dw (HOURS SHL 11) + (MINUTES SHL 5 )+ SECONDS SHR 2
dw ((YEARS - 1980) SHL 9) + (MONTHS SHL 5) + DAYS
times 14 db 0
times 512-($-root) db 0 ; pre-allocate 1 root directory sector
; extend to fill 1.44 Mb image
times (2880-RESERVED_SECTORS-SECTORS_PER_FAT-1)*512 db 0xF6
[/code]
--
Mike Gonta
look and see - many look but few see

https://mikegonta.com
wolfgang kern
2024-03-18 14:26:16 UTC
Permalink
Post by Mike Gonta
Post by wolfgang kern
I'm still busy with manual creation of UEFI-GPT conform environment.
my idea is to make the first partition FAT32, but as small as possible.
because M$-FAT are defined by number of clusters rather then else my
only choice will be to set cluster-size to one sector
[65525 sectors] I need only 512 MB for my OS boot section, what a waste.
are there other ways to shorten a FAT32 w/o breaking too many rules ?
perhaps by write the first 8 bytes of the FAT ?
This is a skeleton of my Fat32 Floppy Disk, (543 sector FAT32 file
system) for 1.44 MB floppy disk.
The trick I used was to mark the minimum FAT32 volume of 66602 outside
the 1.44 Mb as lost (0x0FFFFFF7) in the file allocation table.
[code]
VOLUME_LENGTH = 66602 ; minimum FAT32 volume = 32.5 MB
RESERVED_SECTORS = 21
BYTES_PER_SECTOR = 512
SECTORS_PER_CLUSTER = 1
PARTITION_OFFSET = 0
LABEL equ "           " ; 11 characters maximum
BYTES_PER_CLUSTER = BYTES_PER_SECTOR*SECTORS_PER_CLUSTER
SECTORS_PER_FAT=((VOLUME_LENGTH-RESERVED_SECTORS)+(128*SECTORS_PER_CLUSTER-1))/(128*SECTORS_PER_CLUSTER)
START_OF_DATA = RESERVED_SECTORS+SECTORS_PER_FAT
org 0x7C00
  times 510-($-boot_sector) db 0
  dw 0xAA55
  db "RRaA"
  times 480 db 0
  db "rrAa"
; number of free clusters
  dd VOLUME_LENGTH-RESERVED_SECTORS-SECTORS_PER_FAT
  dd 4 ; number of the next free cluster
  times 12 db 0
  dd 0xAA550000
  times 7*512 db 0
  times 12*512 db 0
  dd 0xFFFFFFF8, 0xFFFFFFFF, 0x0FFFFFFF
  times 2880-RESERVED_SECTORS-SECTORS_PER_FAT-1 dd 0
; mark sectors outside 1.44MB as lost
  times VOLUME_LENGTH-2880 dd 0x0FFFFFF7
  times SECTORS_PER_FAT*BYTES_PER_SECTOR-($-file_allocation_table) db 0
root: ; start of data
  db LABEL
  db 8 ; volume label
  db 0
  db HUNDREDTHS
  dw (HOURS SHL 11) + (MINUTES SHL 5 )+ SECONDS SHR 2
  dw ((YEARS - 1980) SHL 9) + (MONTHS SHL 5) + DAYS
  times 14 db 0
  times 512-($-root) db 0 ; pre-allocate 1 root directory sector
; extend to fill 1.44 Mb image
  times (2880-RESERVED_SECTORS-SECTORS_PER_FAT-1)*512 db 0xF6
[/code]
thanks a lot, this is exactly what I searched for!
__
wolfgang
Paul Edwards
2024-03-19 05:26:26 UTC
Permalink
Post by Mike Gonta
The trick I used was to mark the minimum FAT32 volume of 66602 outside
the 1.44 Mb as lost (0x0FFFFFF7) in the file allocation table.
Very clever!

BFN. Paul.
Mike Gonta
2024-03-19 10:43:55 UTC
Permalink
Post by Paul Edwards
Post by Mike Gonta
The trick I used was to mark the minimum FAT32 volume of 66602 outside
the 1.44 Mb as lost (0x0FFFFFF7) in the file allocation table.
Very clever!
BFN. Paul.
Probably not invented by me.
But, then again it was part of the solution to the "challenge" of
creating a 1.44MB FAT32 floppy disk.
It did however manage to "offend" a lot of people's lack of intelligence.
https://forum.osdev.org/viewtopic.php?t=30339
--
Mike Gonta
look and see - many look but few see

https://mikegonta.com
Loading...