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

2016-01-28 Thread Edward Tomasz Napierała
On 0125T1756, Julian H. Stacey wrote:
> 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.
> 
> I use devd to auto mount USB NTFS, I just it works with 10.2-RELEASE
> & an NTFS USB connected drive, here's a chunk from my
> 
> http://www.berklix.com/~jhs/src/bsd/fixes/FreeBSD/src/jhs/etc/devd/berklix.conf
> 
>action  "sleep 10; \
>  rm -f /devusb/acer300; \
>  ln -s /dev/`echo $device-name|sed -e s/umass/da/`s1 \
> /devusb/acer300.1; \
>  ln -s /dev/`echo $device-name|sed -e s/umass/da/`s2 \
> /devusb/acer300.2; \
>  ln -s /dev/`echo $device-name|sed -e s/umass/da/`s3 \
> /devusb/acer300.3; \
>  mkdir -p /media/acer300.2; mkdir -p /media/acer300.3; \
>  chmod 777 /media/acer300.*; \
>  chown jhs:staff /media/acer300.*; \
>  ntfsfix /devusb/acer300.2 ; \
>  ntfs-3g -o ro /devusb/acer300.2 /media/acer300.2;  \
>  ntfsfix /devusb/acer300.3 ; \
>  ntfs-3g -o ro /devusb/acer300.3 /media/acer300.3" ;
> 
> Now I'll read man 8 automount & other people's alternate solutions
> on the thread :-)

Leaving aside the autofs as such, you might want to take a look
at the /etc/autofs/special_media shell script.  It contains code
to obtain a list of devices available for mounting, which works
with all kinds of devices, without any special cases, and properly
handles problems like "should I mount the whole device, like da0,
or is it partitioned and I should attempt to mount partitions
instead, like da0p1".  You can just run it by hand and see what
output it produces.

___
freebsd-stable@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


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

2016-01-25 Thread Eugene Grosbein
On 25.01.2016 19:14, Andrzej Bylicki wrote:
> Hello,
> 
> I mounted all of my NTFS formatted drives via fuse from the
> sysutils/fusefs-ntfs port. I am not entirely sure, but assuming that it is
> possible to automate the mounting procedure by adding the correct line to
> /etc/fstab.

It is possible to add correct line to /etc/fstab provided that you know
path device file in advance. For example, I have this for my dual-boot
FreeBSD 10.2/Windows 8.1 home system:

/dev/raid/r0s2 /mnt/c fuse 
ro,failok,late,mountprog=/usr/local/bin/ntfs-3g,windows_names,streams_interface=windows,umask=022,inherit,noatime,show_sys_files

Never tried to do automount for USB, though. I just have "/dev/da0s1 /flash 
msdosfs rw,noauto,..."
in my /etc/fstab and do "mount /flash" as needed, manually.
___
freebsd-stable@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


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

2016-01-25 Thread Edward Tomasz Napierała
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.

___
freebsd-stable@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


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

2016-01-25 Thread Edward Tomasz Napierała
On 0125T1943, Eugene Grosbein wrote:
> On 25.01.2016 19:14, Andrzej Bylicki wrote:
> > Hello,
> > 
> > I mounted all of my NTFS formatted drives via fuse from the
> > sysutils/fusefs-ntfs port. I am not entirely sure, but assuming that it is
> > possible to automate the mounting procedure by adding the correct line to
> > /etc/fstab.
> 
> It is possible to add correct line to /etc/fstab provided that you know
> path device file in advance. For example, I have this for my dual-boot
> FreeBSD 10.2/Windows 8.1 home system:
> 
> /dev/raid/r0s2 /mnt/c fuse 
> ro,failok,late,mountprog=/usr/local/bin/ntfs-3g,windows_names,streams_interface=windows,umask=022,inherit,noatime,show_sys_files
> 
> Never tried to do automount for USB, though. I just have "/dev/da0s1 /flash 
> msdosfs rw,noauto,..."
> in my /etc/fstab and do "mount /flash" as needed, manually.

Note that you can easily hook it up to autofs: just uncomment
the "-noauto" map in /etc/auto_master, enable autofs, and "cd"
into /flash.

___
freebsd-stable@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


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

2016-01-25 Thread Kevin Oberman
Thanks, all! Especially to Lars and Edward Tomasz who actually understood
my request (which was probably less clear than it should have been) and
provided the exact incantation required!

Kevin Oberman, Part time kid herder and retired Network Engineer
E-mail: rkober...@gmail.com
PGP Fingerprint: D03FB98AFA78E3B78C1694B318AB39EF1B055683

On Sun, Jan 24, 2016 at 11:37 PM, Lars Engels  wrote:

> On Sun, Jan 24, 2016 at 04:50:13PM -0800, 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.
>
> It's pretty easy:
>
>
> - Install fusefs-ntfs
> - Enable autofs:
>   # sysrc autofs_enable=YES
>   # sysrc autounmountd_flags="-t 10" # unmount after 10s of inactivity
> - Make sure to add this to /etc/auto_master:
>   /media-media  -nosuid
> - Then you need this little patch for /etc/autofs/special_master:
>
> --- special_media.bak   2016-01-19 11:00:55.766975000 +0100
> +++ special_media   2016-01-20 11:29:56.205575000 +0100
> @@ -59,7 +59,16 @@
> continue
> fi
>
> -   echo "-fstype=${_fstype},nosuid :/dev/${_p}"
> +   if [ ${_fstype} = "ntfs" ]; then
> +   if [ -f "/usr/local/bin/ntfs-3g" ]; then
> +   echo
> "-mountprog=/usr/local/bin/ntfs-3g,fstype=${_fstype},nosuid
> :/dev/${_p}"
> +   else
> +   /usr/bin/logger -p info \
> +   "Cannot mount ${_fstype} formatted
> device /dev/${_p}: Install sysutils/fusefs-ntfs first"
> +   fi
> +   else
> +   echo "-fstype=${_fstype},nosuid :/dev/${_p}"
> +   fi
> done
>
> # No matching device - don't print anything, autofs will handle it.
>
> - Start auto$foo:
>   # service automountd start
>   # service automounter start
>   # service automountd start
>
> - Insert the NTFS device
> - Look for a new directory in /media
> - Access it
>
> It's working for me on HEAD, but I guess you should be also successful on
> STABLE
>
>
> --
> Lars
>
___
freebsd-stable@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


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

2016-01-25 Thread Julian H. Stacey
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.

I use devd to auto mount USB NTFS, I just it works with 10.2-RELEASE
& an NTFS USB connected drive, here's a chunk from my

http://www.berklix.com/~jhs/src/bsd/fixes/FreeBSD/src/jhs/etc/devd/berklix.conf

   action  "sleep 10; \
 rm -f /devusb/acer300; \
 ln -s /dev/`echo $device-name|sed -e s/umass/da/`s1 \
/devusb/acer300.1; \
 ln -s /dev/`echo $device-name|sed -e s/umass/da/`s2 \
/devusb/acer300.2; \
 ln -s /dev/`echo $device-name|sed -e s/umass/da/`s3 \
/devusb/acer300.3; \
 mkdir -p /media/acer300.2; mkdir -p /media/acer300.3; \
 chmod 777 /media/acer300.*; \
 chown jhs:staff /media/acer300.*; \
 ntfsfix /devusb/acer300.2 ; \
 ntfs-3g -o ro /devusb/acer300.2 /media/acer300.2;  \
 ntfsfix /devusb/acer300.3 ; \
 ntfs-3g -o ro /devusb/acer300.3 /media/acer300.3" ;

Now I'll read man 8 automount & other people's alternate solutions
on the thread :-)

Cheers,
Julian
--
Julian Stacey,  BSD Linux Unix Sys. Eng. Consultant Munich http://berklix.eu
 Mail plain text,  No quoted-printable, HTML, base64, MS.doc.
 Prefix old lines '> '  Reply below old, like play script.  Break lines by 80.
___
freebsd-stable@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


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

2016-01-25 Thread Andrzej Bylicki
Hello,

I mounted all of my NTFS formatted drives via fuse from the
sysutils/fusefs-ntfs port. I am not entirely sure, but assuming that it is
possible to automate the mounting procedure by adding the correct line to
/etc/fstab.

Hope this helps :).

Best regards,
Andy
___
freebsd-stable@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


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

2016-01-24 Thread Kevin Oberman
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.
--
Kevin Oberman, Part time kid herder and retired Network Engineer
E-mail: rkober...@gmail.com
PGP Fingerprint: D03FB98AFA78E3B78C1694B318AB39EF1B055683
___
freebsd-stable@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"