OpenWrt Forum Archive

Topic: Automount USB hard drive on WNDR3700 with Backfire 10.03.1

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

I googled for the answer, but the information that came back is outdated.  After a lot of piecing bits of information together, I realized the solution is pretty straightforward, but not obvious.  If I left out a step or made a mistake, please let me know and I'll update this post. I tested this with the squashfs version of Backfire 10.03.1.

1. Install the following packages:

kmod-fs-ext4
kmod-fs-ntfs
kmod-fs-msdos
kmod-leds-wndr3700-usb
kmod-fs-cifs
kmod-fs-vfat
kmod-nls-cp437
kmod-nls-utf8
ntfs-3g
fdisk

This should give you everything you need to read NTFS, FAT32, EXT2, EXT3, and EXT4 drives.

2. Follow the directions here to create a custom hotplug script: http://wiki.openwrt.org/doc/howto/writa … lug.script

The script gets saved as /etc/hotplug.d/block/10-mount and will get triggered whenever you plug in or remove a usb drive. [s]Please note that the quotation marks on the wiki have to be changed to regular ones.  Copying and pasting the script as-is will not work.[/s]

3. (Optional) Follow the directions under "Code for the file /etc/hotplug.d/usb/10-usb" here: http://wiki.openwrt.org/toh/netgear/wnd … n.backfire to get the usb led to activate whenever the drive is plugged in.

4. To get the drive to be mounted when the router is booted, follow the directions here: http://wiki.openwrt.org/doc/uci/fstab

[s]Keep the name of the share (on mnt) in fstab config "sda1" since that's what the custom hotplug script does.[/s]

Known issues: USB flash drives can confuse the OS. I think it's due to the weird partitioning on newer usb drives that are "U3 smart drives."

Now that automounting works, you can install samba and access the drive from a Windows PC.  Installing luci-app-samba should be enough to get samba up and running.

(Last edited by GPinzone on 1 Jan 2012, 08:02)

I updated the custom hotplug script on the wiki to fix the quote character problem and I also added the "-l" switch to umount.  If the umount command fails to disconnect the drive due to a process accessing the mount point, the system won't use /dev/sda the next time.  When a device is subsequently plugged in, the OS will increment the slot to /dev/sdb1. Obviously, this can break things if you're relying on the mount points being consistent. Doing a lazy unmount isn't normally good practice, but keep in mind that in order for this to occur, the user pulled out the usb cable or the drive disconnected itself unexpectedly. AFAIK, the "-f" switch won't work in these situations.

I also want to add that you do NOT need to create a mount point in fstab in order for the drive to be automounted on boot.  Here's my /etc/config/fstab:

config 'global' 'automount'
        option 'from_fstab' '1'
        option 'anon_mount' '1'

config 'global' 'autoswap'
        option 'from_fstab' '1'
        option 'anon_swap' '0'

You can verify this also through luci by going to System>Mount Points. The "Mount Points" and "SWAP" sections should be empty and there will be a "/dev/sda1" entry under "Mount Points" above (assuming there's a drive connected).

Just curious, does anyone know why the standard release doesn't include the necessary modules and script(s) by default for the WNDR3700 release?

GPinzone wrote:

Just curious, does anyone know why the standard release doesn't include the necessary modules and script(s) by default for the WNDR3700 release?

Thats mainly because we build generic images for the lowest common denominator and we have no infrastructure in place yet to build release images with per-model package selections.

jow wrote:
GPinzone wrote:

Just curious, does anyone know why the standard release doesn't include the necessary modules and script(s) by default for the WNDR3700 release?

Thats mainly because we build generic images for the lowest common denominator and we have no infrastructure in place yet to build release images with per-model package selections.

That makes sense. The wiki contains a lot of the customization information for the WNDR3700 (like the LEDs, etc.), but it would be nice to be able to easily install all of the supplementary packages necessary to provide the same functionality as the factory firmware. I might go and edit the wiki page to include some of this info.

I'm trying this on the WNDR 3800 (which is supposed to be quite similar to the WNDR3700 I thought) and am not having 100% success.  Are the two different enough that this method won't work?

Ebdain wrote:

I'm trying this on the WNDR 3800 (which is supposed to be quite similar to the WNDR3700 I thought) and am not having 100% success.  Are the two different enough that this method won't work?

I've got this working fine on my WNDR3800. What do you mean not 100%?

Thank you, just made my ntfs external hdd to auto mount and start samba wink (cannot figure out how to do it with fstab)

The discussion might have continued from here.