Public bug reported:

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.

** Affects: dosfstools (Ubuntu)
     Importance: High
     Assignee: Michael Casadevall (mcasadevall)
         Status: Triaged

** Changed in: dosfstools (Ubuntu)
   Importance: Undecided => High

** Changed in: dosfstools (Ubuntu)
     Assignee: (unassigned) => Michael Casadevall (mcasadevall)

** Changed in: dosfstools (Ubuntu)
    Milestone: None => oneiric-alpha-2

** Changed in: dosfstools (Ubuntu)
       Status: New => Triaged

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/794043

Title:
  mkdosfs incorrectly calculates sector total

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to