First Last Prev Next    No search results available      Search page      Enter new bug
Bug#: 112504
Alias:
Product:
Component:
Status: RESOLVED
Resolution: FIXED
Assigned To: Gentoo's Team for Core System packages <base-system@gentoo.org>
Hardware:
OS:
Version:
Priority:
Severity:
Reporter: Ulrich Müller <ulm@gentoo.org>
Add CC:
CC:
URL:
Summary:
Status Whiteboard:
Keywords:

Filename Description Type Creator Created Size Actions
dosfstools-2.11-fat32size.patch dosfstools-2.11-fat32size.patch patch Ulrich Müller 2005-11-14 05:39 0000 1.18 KB Details | Diff
dosfstools-2.11-fat32size.patch dosfstools-2.11-fat32size.patch patch Ulrich Müller 2005-11-14 06:58 0000 1.33 KB Details | Diff
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 112504 depends on: Show dependency tree
Show dependency graph
Bug 112504 blocks:
Votes: 0    Show votes for this bug    Vote for this bug

Additional Comments: (this is where you put emerge --info)







View Bug Activity   |   Format For Printing   |   XML   |   Clone This Bug


Description:   Opened: 2005-11-14 05:38 0000
"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 From Ulrich Müller 2005-11-14 05:39:57 0000 -------
Created an attachment (id=72869) [edit]
dosfstools-2.11-fat32size.patch

------- Comment #2 From SpanKY 2005-11-14 06:35:39 0000 -------
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 From Ulrich Müller 2005-11-14 06:58:33 0000 -------
Created an attachment (id=72871) [edit]
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 From Ulrich Müller 2005-11-14 11:39:49 0000 -------
Upstream has already answered and given his blessing to the patch:
# Thanks, for your report, I've applied the patch in CVS.

------- Comment #5 From SpanKY 2005-11-14 16:42:23 0000 -------
thanks for taking care of that :)

2.11-r1 now in portage with your patch

First Last Prev Next    No search results available      Search page      Enter new bug