Mounting exfat and ntfs-3 filesystems with fstab

This is useful for microsd cards and other media that uses Windows filesystems.

Type gpart show /dev/da0 to see if the filesystem is based on exfat or ntfs. exfat can show up as an ntfs-3 filesystem, because they are referred to by the same partition code of 0x07.

For exfat, install fusefs-exfat, and for ntfs, install sysutils/fusefs-ntfs. sysutils/fusefs-ntfs-compression is needed for compressed XPRESS or LZX files. If fuse-ntfs-compression is installed afterwards, run libtool --finish /usr/lib/ntfs-3g.

/boot/loader.conf
Code:
fuse_load="YES"
Use kldload fuse to load without rebooting.

/etc/fstab
Code:
/dev/da0s1      /mnt/ntfs      ntfs-3g ro,noauto,late,mountprog=/usr/local/bin/ntfs-3g  0 0
/dev/da1s1      /mnt/microsd         exfat   ro,noauto,late,mountprog=/usr/local/sbin/mount.exfat  0 0

mountprog tells the mounter which program to use for a particular special file type. Create the directory in /mnt/ with mkdir for mounting the file system according to the fstab entry.

Now, you can use mount from the commandline, referring to the mountpoint directory.

Thanks to aragats ', staff's and others' posts for some of this information.
 
Just a little addendum …

In general it is advisable to load kernel modules via kld_list="..." in /etc/rc.conf rather than from /boot/loader.conf. Please see the rc.conf(5) manual page for details. The only exception are modules that are required for booting, but that shouldn't be the case for exFAT or NTFS file systems (or anything else that has noauto and/or late in /etc/fstab).
 
Back
Top