Bug 240998 - gpart(8) detects exFAT fs as MBR
Summary: gpart(8) detects exFAT fs as MBR
Status: Closed Not A Bug
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 12.1-RELEASE
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-bugs (Nobody)
Depends on:
Reported: 2019-10-02 08:37 UTC by vermaden
Modified: 2019-10-02 21:02 UTC (History)
1 user (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description vermaden 2019-10-02 08:37:50 UTC
On /dev/md2 I created exFAT filesystem (on whole device).

The gpart(8) tool interprets (incorrectly) that as MBR:

# gpart show md2
=>     63  2097089  md2  MBR  (1.0G)
       63  2097089       - free -  (1.0G)

The fstyp(8) tool correctly shows its exFAT:

# fstyp -u /dev/md2

For the record file(1) is also wrong:

# file -s /dev/md2
/dev/md2: DOS/MBR boot sector

Comment 1 vermaden 2019-10-02 08:38:04 UTC
This is on 12.1-BETA2 system.
Comment 2 Andrey V. Elsukov freebsd_committer 2019-10-02 09:50:35 UTC
gpart(8) is used to manage partition tables. exFAT is filesystem, not a partition table.
Comment 3 vermaden 2019-10-02 10:17:02 UTC
But its a lie, its not a MBR partition table there = bug.
Comment 4 Andrey V. Elsukov freebsd_committer 2019-10-02 10:24:01 UTC
exFAT filesystem has boot sector, that contains MBR's signature:

When you create exFAT filesystem on a raw disk, it automatically creates MBR partition table.
Comment 5 vermaden 2019-10-02 11:06:14 UTC
So gpart should show exFAT/MBR label then?
Comment 6 Conrad Meyer freebsd_committer 2019-10-02 20:33:56 UTC
+1 to everything ae@ has already mentioned.

exFAT (FAT in general) has a DOS MBR boot block at the beginning of the filesystem image.  gpart is for managing partitions.

I understand the confusion, but printing "MBR" when an MBR header is present is a broadly reasonable interpretation of a FAT filesystem header by a tool looking for MBR or GPT partitions.  I'd suggest not putting filesystems on unpartitioned disks, or just not invoking gpart on unpartitioned disks.

file(1) is contrib code, there's some upstream a bug can be reported at.
Comment 7 vermaden 2019-10-02 21:02:34 UTC
Ok, your system, your choice.