Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2026224

Summary: parted reports the type of the fake MBR partition table, created by dosfstools-4.2, as "loop"
Product: Red Hat Enterprise Linux 9 Reporter: Laszlo Ersek <lersek>
Component: partedAssignee: Brian Lane <bcl>
Status: CLOSED WONTFIX QA Contact: Release Test Team <release-test-team-automation>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: rjones
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-12-03 00:26:14 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Laszlo Ersek 2021-11-24 06:57:27 UTC
*** Description of problem:

In dosfstools-4.2 a new option appeared, called "--mbr". Under circumstances that matter much to libguestfs, namely when the disk being formatted is (a) non-removable and (b) unpartitioned (that is, a whole disk, not a partition), the "--mbr" option defaults to "yes". (For the sake of the reproducer below, we'll use an explicit "--mbr=yes".) When this option is in effect, "mkfs.fat" overlays the first sector of the medium (the FAT boot sector) with a bogus MBR partition table. The table has one entry, and it describes a partition that spans the entire disk, covering the partition table itself, resident in the first sector of the medium. This is supposed to placate Windows (otherwise Windows does not recognize the FAT filesystem on a non-removable device), and to work with Linux utilities as well (the kernel itself, and blkid, and so on).

In case the chosen FAT variant is FAT16 or FAT32, parted manages to parse the partition table, and prints the one entry in the table correctly. However, parted incorrectly reports the partition table type as "loop", rather than "msdos".

*** Version-Release number of selected component (if applicable):

- parted-3.4-6.el9.x86_64
  (it should reproduce with upstream parted too, as of commit b20227adf575)

- dosfstools-4.2-3.el9.x86_64

*** How reproducible:

Always.

*** Steps to Reproduce:

(1) rm -f image
    fallocate -l 255M image
    mkfs.fat -F 16 --mbr=yes image
    parted -m -s -- image unit b print 

(2) rm -f image
    fallocate -l 255M image
    mkfs.fat -F 32 --mbr=yes image
    parted -m -s -- image unit b print 

*** Actual results:

parted prints the following:

(1)

BYT;
/root/image:267386880B:file:512:512:loop::;
1:0B:267386879B:267386880B:fat16::;

(2)

BYT;
/root/image:267386880B:file:512:512:loop::;
1:0B:267386879B:267386880B:fat32::;

Note "loop" in both outputs.

*** Expected results:

Create a "normal" partition table:

  rm -f image
  fallocate -l 255M image
  fdisk image
    Command (m for help): n
    Select (default p): p
    Partition number (1-4, default 1): 1
    First sector ...: [accept default]
    Last sector ...: [accept default]

  Command (m for help): w

List it with "parted":

parted -m -s -- image unit b print

Output:

BYT;
/root/image:267386880B:file:512:512:msdos::;
1:1048576B:267386879B:266338304B:::;

Note that the device line contains "msdos", not "loop".

Comment 1 Brian Lane 2021-12-03 00:26:07 UTC
loop is correct, parted it detecting the filesystem at the start of the disk. It isn't a valid msdos disk, you can't partition it any further without damage, and it isn't even a valid MBR -- it just happens to fit into some extra space in the first 512 bytes of the filesystem. It's safer to treat it as a loop mountable device/image than a real msdos disk.

Comment 2 RHEL Program Management 2021-12-03 00:26:14 UTC
Development Management has reviewed and declined this request. You may appeal this decision by reopening this request.