tags 567337 + patch
thanks

whoops, i back my earlier remark -- i could succeed only because i had
an ~/.mtoolsrc on the i386 box that contained:

  mtools_skip_check=1

silly of me to have forgotten that.  Removing that config file showed
the error as usual.

Here's the actual fix (many thanks to Matthew James Goins for helping
figure this out):

The problem is that the number of reserved sectors was changed in 3.0.8
to align the FATs with a 4096-byte boundary, but the boot sector was not
updated to reflect the change.

The attached patch resolves the issue as far as i can tell, by updating
the boot sector's record of the number of reserved sectors.  Note that
according to wikipedia,

 > Reserved sector count. The number of sectors before the first FAT in
 > the file system image. Should be 1 for FAT12/FAT16. Usually 32 for
 > FAT32.

  http://en.wikipedia.org/wiki/File_Allocation_Table#Boot_Sector

This suggests that the actual FAT relocation for alignment purposes
might not be acceptable with some implementations of FAT16 or FAT12.
The attached patch does not fix this (potential) problem -- it just
documents the relocation properly in the boot sector.

I can NMU this if you like.

The patch is also available via git (against the upstream branch) at
git://lair.fifthhorseman.net/~dkg/dosfstools

Thanks for dosfstools.  I hope this analysis and patch are useful.

Regards,

        --dkg
--- dosfstools-3.0.8.orig/src/mkdosfs.c
+++ dosfstools-3.0.8/src/mkdosfs.c
@@ -1059,6 +1059,7 @@
 
     /* Adjust the reserved number of sectors for alignment */
     reserved_sectors = align_object(reserved_sectors, bs.cluster_size);
+    bs.reserved = CT_LE_W(reserved_sectors);
 
     /* Adjust the number of root directory entries to help enforce alignment */
     if (align_structures) {

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to