Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 112504 - dosfstools-2.11: mkdosfs creates invalid FAT32 filesystem
Summary: dosfstools-2.11: mkdosfs creates invalid FAT32 filesystem
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High major (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-14 05:38 UTC by Ulrich Müller
Modified: 2005-11-14 16:42 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
dosfstools-2.11-fat32size.patch (dosfstools-2.11-fat32size.patch,1.18 KB, patch)
2005-11-14 05:39 UTC, Ulrich Müller
Details | Diff
dosfstools-2.11-fat32size.patch (dosfstools-2.11-fat32size.patch,1.33 KB, patch)
2005-11-14 06:58 UTC, Ulrich Müller
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ulrich Müller gentoo-dev 2005-11-14 05:38:44 UTC
"mkdosfs" creates an invalid FAT32 filesystem if the size of the partition is
equal to or slightly larger than 256 MiB.

Reproducible: Always
Steps to Reproduce:
1. Create a partition with a size of exactly 256 MiB, e.g. /dev/sda1
   (I used a USB memory stick for testing).
2. Make a FAT32 filesystem with "mkdosfs -v -F32 /dev/sda1".

Actual Results:
An invalid filesystem that cannot be accessed under Wind*ws.

Expected Results:
Valid filesystem.


According to M$'s documentation, a FAT32 filesystem must not have less than
65525 clusters:
<http://staff.washington.edu/dittrich/misc/fatgen103.pdf> (see p. 15).
With less clusters, the filesystem will be recognised as FAT16.

If the filesystem is exactly 256 MiB in size, mkdosfs will use 4k cluster size,
resulting in less clusters than the above-mentioned threshold.


Here is the output of "fdisk -l /dev/sda":

Disk /dev/sda: 1039 MB, 1039663104 bytes
64 heads, 32 sectors/track, 991 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1         256      262128    c  W95 FAT32 (LBA)


And here the output of "mkdosfs -v -F32 /dev/sda1":

mkdosfs 2.11 (12 Mar 2005)
/dev/sda1 has 64 heads and 32 sectors per track,
logical sector size is 512,
using 0xf8 media descriptor, with 524256 sectors;
file system has 2 32-bit FATs and 8 sectors per cluster.
FAT size is 511 sectors, and provides 65400 clusters.
Volume ID is 437861b4, no volume label.


Attached patch fixes the problem by increasing the limit for 4k clusters from
256 MiB to 260 MiB (<= 532480 sectors), as indicated on p.20 of above document.
The tests for the 8 GiB and 16 GiB limits have been changed from >= to > too.

(Side remark: "dosfsck" does not complain about the bad filesystem, but it
should. I had no time to look into that problem yet.)
Comment 1 Ulrich Müller gentoo-dev 2005-11-14 05:39:57 UTC
Created attachment 72869 [details, diff]
dosfstools-2.11-fat32size.patch
Comment 2 SpanKY gentoo-dev 2005-11-14 06:35:39 UTC
i'd update the comments in the code to include the link to that pdf

could you also e-mail this patch to the upstream author please ?
Comment 3 Ulrich Müller gentoo-dev 2005-11-14 06:58:33 UTC
Created attachment 72871 [details, diff]
dosfstools-2.11-fat32size.patch

> i'd update the comments in the code to include the link to that pdf

Good idea, see updated attachment.

> could you also e-mail this patch to the upstream author please ?

Will do so. I hope that Roman Hodek who is mentioned in README still is
the maintainer of this software.
Comment 4 Ulrich Müller gentoo-dev 2005-11-14 11:39:49 UTC
Upstream has already answered and given his blessing to the patch:
# Thanks, for your report, I've applied the patch in CVS.
Comment 5 SpanKY gentoo-dev 2005-11-14 16:42:23 UTC
thanks for taking care of that :)

2.11-r1 now in portage with your patch