Bug 249067 - dosfslabel fails to read/write label on device-mapper device
Summary: dosfslabel fails to read/write label on device-mapper device
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: dosfstools   
(Show other bugs)
Version: 5.3
Hardware: All
OS: Linux
Target Milestone: ---
: ---
Assignee: Stepan Kasal
QA Contact:
Depends On:
Blocks: 228988
TreeView+ depends on / blocked
Reported: 2007-07-20 18:17 UTC by Jun'ichi NOMURA
Modified: 2013-04-12 19:15 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 483085 (view as bug list)
Last Closed: 2010-01-06 08:55:13 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
a patch for mkdosfs (682 bytes, patch)
2007-07-20 18:17 UTC, Jun'ichi NOMURA
no flags Details | Diff
reproducer shell script (533 bytes, application/x-sh)
2007-07-20 18:20 UTC, Jun'ichi NOMURA
no flags Details

External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2010:0007 normal SHIPPED_LIVE dosfstools bug fix update 2010-01-06 08:55:07 UTC

Description Jun'ichi NOMURA 2007-07-20 18:17:28 UTC
Description of problem:
  dosfslabel fails to read/write label on device-mapper device

Version-Release number of selected component:

How reproducible:

Steps to Reproduce:
  1. Create DM device (multipath, dmraid, etc.)
  2. Execute dosfslabel to write a label on it

Actual results:
  # dosfslabel /dev/mapper/200301384044c0009p1 a
  Invalid disk format in boot sector.
  # dosfslabel /dev/mapper/200301384044c0009p1 
  Invalid disk format in boot sector.

Expected results:
  # dosfslabel /dev/mapper/200301384044c0009p1 a
  # dosfslabel /dev/mapper/200301384044c0009p1 

Additional Info:
  The same operation works on loop device.
    # losetup /dev/loop0 loopfile
    # mkdosfs /dev/loop0
    mkdosfs 2.11 (12 Mar 2005)
    Loop device does not match a floppy size, using default hd params
    # dosfslabel /dev/loop0 a
    # dosfslabel /dev/loop0

  The problem is caused by the following reasons:
    1. dosfslabel checks the FAT superblock to see if the 'secs_track'
       and 'heads' values are non-zero (and they are actually zero),
    2. 'secs_track' and 'heads' are set by mkdosfs, the values came
       from the result of HDIO_GETGEO ioctl or the default ones if the ioctl
       fails (ioctl returns successful but all-zero result),
    3. unless user-space program specifically sets the geometry with
       dm_task_set_geometry() library call, device-mapper device returns
       all-zero geometry for HDIO_GETGEO ioctl (and neither multipath-tools,
       kpartx nor dmraid calls dm_task_set_geometry())

  Possible fix:
    a) Modify multipath-tools, kpartx and dmraid to set the geometry
       on the DM device
    b) Modify device-mapper to return -ENOTTY if the geometry isn't set
    c) Modify mkdosfs to use the default value if the returned geometry
       is all-zero
    d) Modify dosfslabel to ignore 'secs_track' and 'heads' being zero
  a) will be the most productive as it could solve other possible issues
  regarding the geometry and HDIO_GETGEO. But it will take time.

  Others are workaround.
  Attached is a patch to do c).

Comment 1 Jun'ichi NOMURA 2007-07-20 18:17:28 UTC
Created attachment 159671 [details]
a patch for mkdosfs

Comment 2 Jun'ichi NOMURA 2007-07-20 18:20:20 UTC
Created attachment 159672 [details]
reproducer shell script

Test script to do dosfslabel on DM device (on top of loop dev).

# sh dosfslabel-fail.sh 
1+0 records in
1+0 records out
1 byte (1 B) copied, 0.000104256 seconds, 9.6 kB/s
mkdosfs 2.11 (12 Mar 2005)
Invalid disk format in boot sector.
Invalid disk format in boot sector.
Invalid disk format in boot sector.

Comment 3 RHEL Product and Program Management 2007-12-03 20:44:18 UTC
This request was evaluated by Red Hat Product Management for
inclusion, but this component is not scheduled to be updated in
the current Red Hat Enterprise Linux release.  This request will
be reviewed for a future Red Hat Enterprise Linux release.

Comment 9 Daniel Baumann 2009-12-24 09:07:57 UTC

I could not reproduce this, it works fine with 3.0.6.


Comment 10 errata-xmlrpc 2010-01-06 08:55:13 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.


Note You need to log in before you can comment on or make changes to this bug.