Bug 244461 - gpart: Shows exFat as NTFS
Summary: gpart: Shows exFat as NTFS
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: Unspecified
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs mailing list
URL:
Keywords: needs-qa
Depends on:
Blocks:
 
Reported: 2020-02-27 06:35 UTC by Brian Zou
Modified: 2020-03-14 10:40 UTC (History)
4 users (show)

See Also:


Attachments
This device on macOS. (586.00 KB, image/png)
2020-02-28 04:28 UTC, Brian Zou
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Brian Zou 2020-02-27 06:35:22 UTC
My USB store device is 64GB ExFAT.

but using `gpart` command show NTFS?

```shell
[zoujiaqing@freebsd /home/zoujiaqing]$ sudo mount.exfat /dev/da0s1 /mnt
FUSE exfat 1.3.0
fuse: failed to open fuse device: No such file or directory
[zoujiaqing@freebsd /home/zoujiaqing]$ gpart show da0
=>       63  125829057  da0  MBR  (60G)
         63        385       - free -  (193K)
        448  125828672    1  ntfs  (60G)
```
Comment 1 Chris Hutchinson 2020-02-27 17:55:10 UTC
(In reply to Brian Zou from comment #0)
whats the output from:

gpart list da0

It might be that the exfat part is inside an
ntfs. The gpart command I suggested above will
remove any doubt(s). :)

--Chris
Comment 2 Tatsuki Makino 2020-02-27 21:26:33 UTC
I also want a kind display like ntfs/exfat .
Why exfat used the same partition ID as ntfs? :)
Comment 3 Tatsuki Makino 2020-02-27 21:31:09 UTC
(In reply to Brian Zou from comment #0)

You haven't forgotten kldload fuse.ko, have you?
Comment 4 Chris Hutchinson 2020-02-28 03:25:52 UTC
(In reply to Tatsuki Makino from comment #3)
No. But *you* might have. :)
I suggested using: gpart list da0
so you would know what your currently running
system sees on that drive. You get very
detailed output.

--Chris
Comment 5 Kubilay Kocak freebsd_committer freebsd_triage 2020-02-28 04:12:01 UTC
What version of FreeBSD (uname -a) is running on the effected system?
Comment 6 Conrad Meyer freebsd_committer 2020-02-28 04:19:03 UTC
I think they have the same label, at least for MBR?
Comment 7 Brian Zou 2020-02-28 04:28:12 UTC
Created attachment 212014 [details]
This device on macOS.
Comment 8 Brian Zou 2020-02-28 04:31:23 UTC
[zoujiaqing@freebsd ~]$ uname -a
FreeBSD freebsd 13.0-CURRENT FreeBSD 13.0-CURRENT #0 r358133: Thu Feb 20 04:41:10 UTC 2020     root@releng1.nyi.freebsd.org:/usr/obj/usr/src/amd64.amd64/sys/GENERIC  amd64
[zoujiaqing@freebsd /usr/home/zoujiaqing]$ sudo kldload fusefs
kldload: can't load fusefs: module already loaded or in kernel
[zoujiaqing@freebsd /usr/home/zoujiaqing]$ sudo mount /dev/da0s1 /mnt
mount: /dev/da0s1: No such file or directory
[zoujiaqing@freebsd /usr/home/zoujiaqing]$ gpart show da0
=>       63  125829057  da0  MBR  (60G)
         63        385       - free -  (193K)
        448  125828672    1  ntfs  (60G)

[zoujiaqing@freebsd ~]$ gpart list da0
Geom name: da0
modified: false
state: OK
fwheads: 255
fwsectors: 63
last: 125829119
first: 63
entries: 4
scheme: MBR
Providers:
1. Name: da0s1
   Mediasize: 64424280064 (60G)
   Sectorsize: 512
   Stripesize: 0
   Stripeoffset: 229376
   Mode: r0w0e0
   efimedia: HD(1,MBR,00000000,0x1c0,0x77ffe40)
   rawtype: 7
   length: 64424280064
   offset: 229376
   type: ntfs
   index: 1
   end: 125829119
   start: 448
Consumers:
1. Name: da0
   Mediasize: 64424509440 (60G)
   Sectorsize: 512
   Mode: r0w0e0
[zoujiaqing@freebsd ~]$ sudo ntfs-3g /dev/da0s1 /mnt
NTFS signature is missing.
Failed to mount '/dev/da0s1': Invalid argument
The device '/dev/da0s1' doesn't seem to have a valid NTFS.
Maybe the wrong device is used? Or the whole disk instead of a
partition (e.g. /dev/sda, not /dev/sda1)? Or the other way around?
Comment 9 Andrey V. Elsukov freebsd_committer 2020-02-28 12:11:13 UTC
1. gpart(8) doesn't detect type of used file system. It just reports partition type used in partition table for specific partition. It is NTFS for MBR.
2. Probably, you just need to load fusefs kernel module.
Comment 10 Tatsuki Makino 2020-02-28 21:50:20 UTC
Isn't this just a report that says, "If partition type ID of MBR is 7, you can't determine whether it's NTFS or exFAT (or HPFS)." ? :)

The following commands should have been a little more detailed about what is missing. But, you need to umount it by turning it to background or using another terminal.

mount.exfat-fuse -d -o ro /dev/da0s1 /mnt

On my device, da0 may appear immediately, but da0s1 may not.
It can be restored with the following command in 10 (.4-STABLE) but not in 12.1-STABLE I am using now.

camcontrol reset da0 && camcontrol reprobe da0
Comment 11 Andrey V. Elsukov freebsd_committer 2020-02-29 14:21:49 UTC
(In reply to Tatsuki Makino from comment #10)

gpart(8) is not that utilite, that should determine file system type.
I think fstyp(8) is more appropriate for this purpose.
Comment 12 Tatsuki Makino 2020-03-01 04:43:43 UTC
(In reply to Andrey V. Elsukov from comment #11)
Thank you for introducing useful command.

In other words, I want to be guided to use fstyp by manpages and handbook when gpart returns ntfs.
Although manpage of gpart says "A partition that contains a NTFS or exFAT filesystem.".


(In reply to Brian Zou from comment #0)
I'm sorry to digress from your original problem.
Comment 13 georg.lastname 2020-03-14 10:26:07 UTC
Ntfs - one word for two different things.

ntfs exists as a partition type (gpart add -t ntfs ..).
But it can also be a file system (fstyp shows it, or create it with mkntfs from pkg ntfs-3g)

I don't think there is a bug.
Comment 14 georg.lastname 2020-03-14 10:40:08 UTC
Man file of gpart says:
"ntfs - A partition that contains a NTFS or exFAT filesystem."

This does not mean that there is necessarily a file system on the partition.
It just means that you can create only those two file system types on a ntfs partition.