OpenWrt Forum Archive

Topic: mount with ntfs-3g

The content of this topic has been archived on 19 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

searched in the forum but couldn't find any useful info.
mounting with
  ntfs-3g /dev/sdc2 /mnt/ntfspart -o rw
works but mounting with
  mount -t nfts-3g /dev/sdc2 /mnt/ntfspart -o rw
or
  mount -t fuse /dev/sdc2 /mnt/ntfspart -o rw,defaults,locale=de.DE.utf8,umask=000
does not.

any pointers?

ps I can mount with the kmod-fs-ntfs but this is not what I want

To mount '-t nfts-3g /dev/sdc2 /mnt/ntfspart -o rw'
You can just make a symlink like this:
ln -s /usr/bin/ntfs-3g /sbin/mount.ntfs-3g

I have made and use this patch that does this under compiling. I'm not sure if this is the proper or right way to do it, but it works for me, and I can mount ntfs-3g within LuCI.

--- feeds/packages/utils/ntfs-3g/Makefile       2010-03-30 02:19:20.000000000 +$
+++ feeds/packages/utils/ntfs-3g/Makefile       2010-03-30 01:24:42.000000000 +$
@@ -109,6 +109,8 @@
define Package/ntfs-3g/install
        $(INSTALL_DIR) $(1)/usr/bin
        $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ntfs-3g{,.probe} $(1)/usr/bin/
+       mkdir  $(1)/sbin/
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/ntfs-3g $(1)/sbin/mount.ntfs-3g
        $(INSTALL_DIR) $(1)/usr/lib
        $(CP) $(PKG_INSTALL_DIR)/usr/lib/libntfs-3g.so.* $(1)/usr/lib/
endef

yes this trick with the ln was the first thing I tried but it didn't work. So I'm quite unsure if your patch will do any better...

You are absolutely right it won't work, because I forgot to mention that you have to add:
CONFIG_BUSYBOX_CONFIG_FEATURE_MOUNT_HELPERS=y
in your config file or do it in the busybox settings, and compile.

(Last edited by Protx on 7 May 2010, 01:44)

Protx wrote:

You are absolutely right it won't work, because I forgot to mention that you have to add:
CONFIG_BUSYBOX_CONFIG_FEATURE_MOUNT_HELPERS=y
in your config file or do it in the busybox settings, and compile.

I've recompiled busybox with this switch and now ln -s works. Thank you for the hint

flux wrote:
Protx wrote:

You are absolutely right it won't work, because I forgot to mention that you have to add:
CONFIG_BUSYBOX_CONFIG_FEATURE_MOUNT_HELPERS=y
in your config file or do it in the busybox settings, and compile.

I've recompiled busybox with this switch and now ln -s works. Thank you for the hint

do you know the size difference between the two busybox (with and without this setting)?

zorxd wrote:

do you know the size difference between the two busybox (with and without this setting)?

old size - 363177
new size - 366069

its for x86 platform

Hi!
I also want to mount ntfs with ntfs-3g under luci, but i don't know where is must add CONFIG_BUSYBOX_CONFIG_FEATURE_MOUNT_HELPERS=y. In wiche diretory can i find this config file?

In the build-system. You have to build a image by yourself. It's a menuconfig option.

Okay, Thank you for the fast replay.

I don't have a Linux and can't build my own OpenWrt.config. Is there a other way get ntfs-3g work in Luci or automount it?

Install Linux in a virtual machine. That's enough...

I am a Linux noob and have nerver before compilet a file. Is it possibel to make the changs in the openwrtbuilder?

Then it's time to start compiling by yourself smile

at least on buffalo wzr it is possible to automount with hotplug instead of mount

Hi vladkon, how were you able to automount with hotplug.d?  It fails for me, even after adding a sleep 20 in the script.  It works fine in init.d as a script run as 99 however (example 99-usb).

yes i'm able to automount with hotplug. works fine for me. see here on how to configure it http://blog.podspring.com/?tag=openwrt

(Last edited by vladkon on 19 Jul 2010, 15:07)

I also tried manipulate my /etc/hotplug.d/block/xx-mount script and it works.

#!/bin/sh
# Copyright (C) 2009-2010 OpenWrt.org
# Copyright (C) 2010 Vertical Communications
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

. /lib/functions/block.sh

blkdev=`dirname $DEVPATH`
if [ `basename $blkdev` != "block" ]; then

    device=`basename $DEVPATH`

    case "$ACTION" in
        add)

                local from_fstab
                local anon_mount
                local anon_swap
                local anon_fsck
                local mds_mount_target
                local mds_mount_device
                local mds_mount_fstype
                local sds_swap_device
                local use_device
                local do_fsck=0
                local fsck_type

                local autoswap_from_fstab
                local automount_from_fstab

            mount_dev_section_cb() {
                mds_mount_target="$2"
                        mds_mount_device="$3"
                        mds_mount_fstype="$4"
                        mds_mount_enabled="$6"
            }

            swap_dev_section_cb() {
                        sds_swap_device="$2"
                        return 0
            }

                config_get_automount
                automount_from_fstab="$from_fstab"
                [ "$automount_from_fstab" -eq 1 ] && {
                        config_get_mount_section_by_device "/dev/$device"
                        use_device="$mds_mount_device"
                        [ "$mds_mount_enabled" -eq 1 ] && {
                                if [ -n "$mds_mount_target" ]; then
                                        grep -q "/dev/$device" /proc/swaps || grep -q "/dev/$device" /proc/mounts || {

                                                if [ "$mds_mount_fstype" = "ntfs-3g" ];
                                                then
                                                        ( mkdir -p "$mds_mount_target" && ntfs-3g "$mds_mount_device" "$mds_mount_target" ) 2>&1 | tee /proc/self/fd/2 | logger -t 'fstab'
                                                else

                                                        ( mkdir -p "$mds_mount_target" && mount "$mds_mount_target" ) 2>&1 | tee /proc/self/fd/2 | logger -t 'fstab'
                                                fi
                                        }
                                else
                                        logger -t 'fstab' "Mount enabled for $mds_mount_device but it doesn't have a defined mountpoint (target)"
                                fi
                        }
                }

                [ -z "$use_device" ] && {
                        config_get_autoswap
                        autoswap_from_fstab="$from_fstab"

                        [ "$autoswap_from_fstab" -eq 1 ] && {
                                config_get_swap_section_by_device "/dev/$device"
                                use_device="$sds_swap_device"
                        }
                }

                grep -q "/dev/$device" /proc/swaps || grep -q "/dev/$device" /proc/mounts || {
                        [ "$anon_mount" -eq 1 ] && [ -z "$use_device" ] && {
                                ( mkdir -p /mnt/$device && mount /dev/$device /mnt/$device ) 2>&1 | tee /proc/self/fd/2 | logger -t 'fstab'
                        }
                }
                reset_dev_section_cb
                ;;
        remove)
                umount /dev/$device
                ;;
    esac

fi

Now i can automount ntfs-filesystems with Luci. It only works with ntfs-3g when you configure in Luci the files systeme. When i use a hdd with other filesystem i always need to change the config in Luci. Now i try to integrate a automatic mount command choose for each filesystem but i don't find a function for autodetecting the filesystem. Did somebody know such a function??

I still search a function which detect the filesystem.

The Busybox mount helpers option (CONFIG_BUSYBOX_CONFIG_FEATURE_MOUNT_HELPERS) got enabled by default finally smile

- Backfire r25816
- Trunk r25815

Now you can mount the NTFS partition directly in /etc/config/fstab without any extra scripts!

(Last edited by written_direcon on 1 Mar 2011, 21:15)

The discussion might have continued from here.