Auto-mounting USB NTFS formatted devices on FreeBSD 10.2 and HEAD

Edward Tomasz Napierała trasz at freebsd.org
Mon Jan 25 15:11:21 UTC 2016


On 0124T1650, Kevin Oberman wrote:
> Since the removal of NTFS support, it is unclear how to get USB drives
> formatted as NTFS (or ExFAT) to automatically mount. Prior to FreeBSD 10 it
> was possible to replace /sbin/mount_ntfs with a script that would generate
> appropriate options and exec /usr/local/sbin/ntfs-3g and let HAL fire up
> mount_ntfs, but that no longer works as mount_ntfs is no longer used and
> mount(8) no longer treats '-t ntfs' as special.
> 
> It would appear that automount(8) would be the right magic, but it's not
> obvious to me how to configure it to recognize that an NTFS device has been
> connected to a USB port (as opposed to msdosfs) and to use ntfs-3g to do
> the actual mount. I assume that the same issue exists for ExFAT.
> 
> Does anyone have an idea of what magic is required in the auto_master or
> elsewhere to make this work in conjunction with devd? I'd really like to
> avid using hald, if possible.

Try to apply the following diff in /etc/autofs/:

Index: special_media
===================================================================
--- special_media	(revision 294670)
+++ special_media	(working copy)
@@ -35,7 +35,11 @@ print_one() {
 
 	_fstype="$(fstyp "/dev/${_key}" 2> /dev/null)"
 	if [ $? -eq 0 ]; then
-		echo "-fstype=${_fstype},nosuid	:/dev/${_key}" 
+		if [ ${_fstype} = "ntfs" ]; then
+			echo "-fstype=${_fstype},nosuid,mountprog=/usr/local/bin/ntfs-3g	:/dev/${_key}" 
+		else
+			echo "-fstype=${_fstype},nosuid	:/dev/${_key}" 
+		fi
 		return
 	fi
 
@@ -59,7 +63,11 @@ print_one() {
 			continue
 		fi
 
-		echo "-fstype=${_fstype},nosuid	:/dev/${_p}" 
+		if [ ${_fstype} = "ntfs" ]; then
+			echo "-fstype=${_fstype},nosuid,mountprog=/usr/local/bin/ntfs-3g	:/dev/${_p}" 
+		else
+			echo "-fstype=${_fstype},nosuid	:/dev/${_p}" 
+		fi
 	done
 
 	# No matching device - don't print anything, autofs will handle it.



More information about the freebsd-stable mailing list