[syslinux] [PATCH 1/5] fat: fix minfatsize for large FAT32

Gene Cumm
2016-02-26T11:49:36Z

On Thu, Feb 25, 2016 at 7:59 PM, Pete Batard via Syslinux
<syslinux at zytor.com> wrote:
> Hi Ady,
>
> Your insightful post prompted me to to a little bit more digging as to how
> the Ridgecrop algorithm computed its FAT size, with the result of my
> investigations presented below.
>
> NB: For those who don't want to go through this whole part, there's
a TL;DR
> near the end.


> *TL;DR*: The Ridgecrop Fat Size computation algorithm is wrong, and,
whether
> justified or not, the existing Syslinux check does catch FATs that are
> missing addressable sectors.
>
>
> I have now tested the new computation against a 320GB and 1TB drive, and
> found that the original minfatsize check of Syslinux is no longer an issue.
>
> This being said, and to address Ady's subsequent point:
>
> While I can now address the issue in Rufus (and will contact Tom Thornhill
> of Ridgecrop to let him know about both the issue & fix), I suspect
there
> are users out there who are using and will continue to use fat32format.exe
> with the bad computation algorithm, as well as other developers who might
> lift the existing Large FAT32 format code without realizing that doing so
> will break Syslinux installation. So it may still be worth relaxing the
> check especially if, as Ady pointed out, not having all sectors addressable
> doesn't make a disk any less valid.


I think there may be another answer to this:

1) a tool to fix the broken FSs by "wasting" the high clusters of the
file system, a non-destructive correction.  As it stands they're
effectively wasted already and might risk a user thinking the file
system isn't full when in fact the FAT itself is.

2) The recommendation to use the Syslinux installer's "-f" flag
until
the individual file system is corrected with the above tool, assuming
"-f" circumvents this check.  I've been tossing the idea around
that a
single "-f" might not be the best answer and a longer option
specifying a list of checks to skip might be more balanced, ie "-F
minfatsize,othercheck".

3) Ensure that the Syslinux installers state which check failed to
assist users in correcting their file system, regardless of if "-f" is
specified.  If "-f" is not specified, installation should fail
completely (hopefully with 0 alterations).  If "-f" is specified but
not necessary (indicating a user/tool that isn't being cautious),
consider throwing a warning while still allowing the install and
returning a success to the caller of the installer.

> [1]
>
https://github.com/pbatard/rufus/blob/ade5639c0047ee813f71a8bfef8b1cc7be551009/src/format.c#L349-L377
> [2] http://hjem.get2net.dk/rune_moeller_barnkob/filesystems/fat.html
> [3] http://pierrelib.pagesperso-orange.fr/filesystems/fat16.html

--
-Gene