"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.)
Created attachment 72869 [details, diff] dosfstools-2.11-fat32size.patch
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 ?
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.
Upstream has already answered and given his blessing to the patch: # Thanks, for your report, I've applied the patch in CVS.
thanks for taking care of that :) 2.11-r1 now in portage with your patch