Re: Problem mounting new Sandisk 1TB USB drive

From: Polytropon <freebsd_at_edvax.de>
Date: Thu, 11 Jan 2024 00:42:15 UTC
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:
> >> The stick has been plugged into an android phone since it was first
> >> tried on the fbsd and ubuntu systems, before I installed ntfs-3g.
> >> Mounting it on ubuntu, I see two suspect files, 'Install SanDisk Software.dmg' and 'Install SanDisk Software.exe', plus a pdf that
> >> says to run the appropriate file to get "valuable software..."
> >> I'm thinking / hoping neither of those got automagically run, since
> >> it's never been plugged into a microsoft or mac system.  I've since
> >> renamed them away.
> > 
> > This observation leads to the following assumption:
> > 
> > The stick is actually pre-formatted with exFAT.
> > 
> > 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.
> > 
> > So here is what you should check:
> > 
> > 1. /boot/loader.conf contains:
> > 
> > 	fuse_load="YES"
> 
> /boot/loader.conf.local:
> # added and commented out amdtemp; no longer needed?
> #amdtemp="YES"
> verbose_loading="YES"
> # Enable FUSE functionality for exfat filesystem mounting
> fuse_enable="YES"
> fuse_load="YES"

THe _enable settings belong to /etc/rc.conf; /boot/loader.conf
uses the _load settings.



> > 2. Mount device manually, read-only, perform checks, then
> >     unmount again:
> > 
> > 	# mount.exfat -o ro /dev/da0s1 /mnt/memstick
> > 	# df -f /mnt/memstick
> > 	# ls -R /mnt/memstick
> > 	# umount /mnt/memstick
> 
> What was the intent of the df -f (-f => invalid option)?

Should have been "df -h". :-)

Intention: Compare "dmesg" entry (device reporting size)
with filesystem size, and then compare to what's written
on the device itself.



> That seemed to work, although it was properly umounted on a ubuntu
> system; or at least I think so.  It was automagically mounted when
> plugged in, not written to, and then sync ; umount.

That sounds correct. The "eject device" in most GUI file
managers (including that of Gnome) performs those steps.
However, just be sure, and _know_ better than guess. :-)



> A series of mount.exfat / umount / mount.exfat on fbsd seemed to
> clear it up.

There are also fsck tools for most filesystems, and there
probably is one for exFAT, just in case.



> > NB: mount.exfat does not have a manpage or help option.
> 
> $ apropos exfat
> mount.exfat-fuse(8) - mount an exFAT file system

Okay, thanks for that pointer. It's not obvious that you
need the manpage of "mount.exfat-fuse" when you want to
know the options of "mount.exfat" though...



> > 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. ;-)
> 
> 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.

In worst case, let the target deivce format the stick.
I've once been bitten by that because I "knew better"
and preformatted a SD card with FAT, just to discover
that my digital camera doesn't like it - it wanted the
old 8.3 type format instead of the -F 32 one.

In your specific case, exFAT (or FAT with the -F 32
format - see "man newfs_msdos") is probably the safest
way for data exchange here.



> It appears the problem was not having fusefs.ko loaded, but
> continuing trying ntfs-3g instead of retrying mount.exfat.

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.



> So all is well, thanks, but one question not addressed:
> Given that FUSE_ENABLE="YES" is present in rc.conf,
> why is kldlist="fusefs" still needed?

Personally, I am explicit instead of relying on "chains"
here: I put fuse_enable="YES" in /boot/loader.conf and
have the correct module loaded. Simple things need to
be simple and kept boring. :-)


-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...