mkdosfs incorrectly calculates sector total

Bug #794043 reported by Michael Casadevall
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
dosfstools (Ubuntu)
Fix Released
High
Michael Casadevall
Hardy
Won't Fix
Undecided
Unassigned
Lucid
Won't Fix
Undecided
Unassigned
Maverick
Won't Fix
Undecided
Unassigned
Natty
Won't Fix
Undecided
Unassigned

Bug Description

Binary package hint: dosfstools

mkdosfs will incorrectly calculate the number of sectors of a given FAT partition if the number sectors are odd due to count_blocks incorrectly handling the remainder of a division operation. This miscalculation causes the OMAP4 bootloader to fail to boot.

This bug can be observed by comparing the total sector size in fdisk expert more to fsck.msdos; this discrepancy only shows up when the number of sectors are odd:

fdisk output:

Expert command (m for help): p

Disk /dev/sdb: 204 heads, 3 sectors, 12654 cylinders

Nr AF Hd Sec Cyl Hd Sec Cyl Start Size ID
 1 00 1 1 0 203 3 258 3 158505 83
 2 00 0 0 0 0 0 0 0 0 00
 3 00 0 0 0 0 0 0 0 0 00
 4 00 0 0 0 0 0 0 0 0 00

mcasadevall@daybreak:~/src/dosfstools-3.0.9$ sudo fsck.msdos -v /dev/sdb1
dosfsck 3.0.9 (31 Jan 2010)
dosfsck 3.0.9, 31 Jan 2010, FAT32, LFN
Checking we can access the last sector of the filesystem
Boot sector contents:
System ID "mkdosfs"
Media byte 0xf8 (hard disk)
       512 bytes per logical sector
      2048 bytes per cluster
         4 reserved sectors
First FAT starts at byte 2048 (sector 4)
         2 FATs, 16 bit entries
     79872 bytes per FAT (= 156 sectors)
Root directory starts at byte 161792 (sector 316)
       512 root directory entries
Data area starts at byte 178176 (sector 348)
     39539 data clusters (80975872 bytes)
3 sectors/track, 204 heads
         0 hidden sectors
    158504 sectors total
Checking for unused clusters.
/dev/sdb1: 0 files, 0/39539 clusters

Compare the difference in sectors total. The attached patch correctly handles the remainder and causes the sector counts to match.

Related branches

Changed in dosfstools (Ubuntu):
importance: Undecided → High
assignee: nobody → Michael Casadevall (mcasadevall)
milestone: none → oneiric-alpha-2
status: New → Triaged
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package dosfstools - 3.0.9-1ubuntu1

---------------
dosfstools (3.0.9-1ubuntu1) oneiric; urgency=high

  * Added debian/patches/01_fix_sector_count.patch (LP: #794043)
    - Fix a bug where sector counts would be off-by-one due to a division
      error. Required for OMAP3/4 bootROM to always be happy with a partition
 -- Michael Casadevall <email address hidden> Tue, 07 Jun 2011 03:29:05 -0700

Changed in dosfstools (Ubuntu):
status: Triaged → Fix Released
Revision history for this message
Paul Sokolovsky (pfalcon) wrote :

> "This miscalculation causes the OMAP4 bootloader to fail to boot."
> "Fix a bug where sector counts would be off-by-one due to a division error. Required for OMAP3/4 bootROM to always be happy with a partition"

Can you please confirm that this patch actually fixes FS metadata fields and makes odd-sized partition bootable by OMAP? Or is the idea is to fix partition info output to make it easy to spot non-compliant partition? Thanks.

Revision history for this message
Rolf Leggewie (r0lf) wrote :

Maverick has long since stopped to receive any updates. Marking the Maverick task for this ticket as "Won't Fix".

Changed in dosfstools (Ubuntu Maverick):
status: New → Won't Fix
Revision history for this message
Rolf Leggewie (r0lf) wrote :

Hardy has seen the end of its life and is no longer receiving any updates. Marking the Hardy task for this ticket as "Won't Fix".

Changed in dosfstools (Ubuntu Hardy):
status: New → Won't Fix
Revision history for this message
Rolf Leggewie (r0lf) wrote :

natty has seen the end of its life and is no longer receiving any updates. Marking the natty task for this ticket as "Won't Fix".

Changed in dosfstools (Ubuntu Natty):
status: New → Won't Fix
Revision history for this message
Rolf Leggewie (r0lf) wrote :

lucid has seen the end of its life and is no longer receiving any updates. Marking the lucid task for this ticket as "Won't Fix".

Changed in dosfstools (Ubuntu Lucid):
status: New → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.