Date: Sat, 13 Jan 2024 18:22:42 +1100 From: Ian Smith <smithi@nimnet.asn.au> To: Polytropon <freebsd@edvax.de>,freebsd@dreamchaser.org Cc: FreeBSD Mailing List <freebsd-questions@freebsd.org> Subject: Re: Problem mounting new Sandisk 1TB USB drive Message-ID: <B01CA8C4-6F3F-451D-8332-70763C18E4FF@nimnet.asn.au> In-Reply-To: <20240111014215.d25a19f3.freebsd@edvax.de> References: <746cd0fe-9de8-414b-8b5d-7030d423fa7f@dreamchaser.org> <d00f483a-5956-4d1d-bf60-13b8fa159b47@souji-thenria.net> <b47a25dd-3fde-494b-8afe-0766afbc1016@dreamchaser.org> <85758e7a-f9bb-4568-a863-53c2439045ce@souji-thenria.net> <e997f796-ea07-4fca-a483-a3de42870e6d@dreamchaser.org> <20240110233304.7a8b7f10.freebsd@edvax.de> <1d60d68a-3569-4054-a460-41c5dd422a42@dreamchaser.org> <20240111014215.d25a19f3.freebsd@edvax.de>
next in thread | previous in thread | raw e-mail | index | archive | help
Late to the 'old and stupid' party =2E=2E=2E out of the pile, I'm respondin= g to this one since Gary gives it as reference in his PR revival at https://bugs=2Efreebsd=2Eorg/bugzilla/show_bug=2Ecgi?id=3D244461 On 11 January 2024 11:42:15 am AEDT, Polytropon <freebsd@edvax=2Ede> wrote= : > On Wed, 10 Jan 2024 16:42:22 -0700, Gary Aitken wrote: > > On 1/10/24 15:33, Polytropon wrote: > > > On Wed, 10 Jan 2024 13:03:28 -0700, Gary Aitken wrote: (cutting mercilessly) > > > The stick is actually pre-formatted with exFAT=2E > > >=20 > > > Problem here: exFAT disguises itself as an NTFS partition, > > > but it does not have NTFS metadata and content, so ntfs-3g > > > cannot mount it, even though tools like gpart or fdisk > > > show a NTFS partition=2E It's worse than that, thanks again Microsoft! Reference: https://en=2Em= =2Ewikipedia=2Eorg/wiki/Partition_type MBR partition type 7 can be IFS, HPFS (both OS/2), NTFS or ExFAT (both MS)= =2E It's kinda understandable between HPFS and NTFS; well before FUSE there wa= s read safely / write maybe code for both that was largely identical=2E I u= sed it to read old OS/2 disks up to about FreeBSD 9=2E But overlaying NTFS with ExFAT was unforgivable really =2E=2E=2E as this t= hread adequately demonstrates=2E > > > So here is what you should check: > > >=20 > > > 1=2E /boot/loader=2Econf contains: > > >=20 > > > fuse_load=3D"YES" > > # Enable FUSE functionality for exfat filesystem mounting > > fuse_enable=3D"YES" > > fuse_load=3D"YES" >=20 > THe _enable settings belong to /etc/rc=2Econf; /boot/loader=2Econf > uses the _load settings=2E > > > 2=2E Mount device manually, read-only, perform checks, then > > > unmount again: > > >=20 > > > # mount=2Eexfat -o ro /dev/da0s1 /mnt/memstick > > > # df -f /mnt/memstick > > > # ls -R /mnt/memstick > > > # umount /mnt/memstick =20 > Should have been "df -h"=2E :-) >=20 > Intention: Compare "dmesg" entry (device reporting size) > with filesystem size, and then compare to what's written > on the device itself=2E =20 > > A series of mount=2Eexfat / umount / mount=2Eexfat on fbsd seemed to > > clear it up=2E > There are also fsck tools for most filesystems, and there > probably is one for exFAT, just in case=2E sysutils/exfat-utils : exfatfsck(8) also mkexfatfs(8), dumpexfat(8), exfatlabel(8)=2E > > > NB: mount=2Eexfat does not have a manpage or help option=2E > >=20 > > $ apropos exfat > > mount=2Eexfat-fuse(8) - mount an exFAT file system > Okay, thanks for that pointer=2E It's not obvious that you > need the manpage of "mount=2Eexfat-fuse" when you want to > know the options of "mount=2Eexfat" though=2E=2E=2E sysutils/fusefs-exfat is installed as mount=2Eexfat-fuse, with a symlink f= or /usr/local/sbin/mount=2Eexfat Unfortunately there's no such link for manpage mount=2Eexfat-fuse(8) > > > Why don't you simply run newfs on the stick, with the > > > filesystem *you* _want_ to use? You can use UFS it you > > > want to, works perfectly well=2E ;-) > >=20 > > I want to be able to read it from an android phone, and I was/am > > concerned reformatting may make it unreadable by the phone=2E I was pleasantly surprised to hear that Android reads/writes exfat=2E I in= stalled it for Ventoy, but can now directly write from the phone, ta! I als= o have some 64G USB2 sticks that become useful with exfat=2E > That's a trap to easily fall into: exFAT does not identify > itself as exFAT or FAT, but as NTFS, but it is not NTFS=2E Nor is it HPFS (in about 7 years of OS/2 in the nineties, I can't recall l= osing a single file to HPFS) ~~~~~~~ To address points Gary raises in the abovementioned PR: -> I would consider it a bug=2E Documenting ambiguous behavior does not ma= ke it any less of a problem=2E Agreed=2E -> It affects anyone who attempts to mount a usb stick with >32GB of stora= ge=2E Well, and smaller exfat media too=2E -> If gpart can tell that a partition is exFAT, it should report it as suc= h to avoid confusion It doesn't seem like a small 'if'=2E It means adding code to detect the real type in use - and there may be non= e before a makefs=2E And it's not binary; IFS and HPFS as well=2E Maybe there's some simple te= st to delineate between those four, some clear signature? I don't know; yo= u'd need to examine fsck (or analogous) code, test and present it to the gp= art maintainer=2E Good luck!
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?B01CA8C4-6F3F-451D-8332-70763C18E4FF>