Automount NFS drive?

Discussion about my Wifi Radio project at http://mightyohm.com/wifiradio/ or my WL-520gU talk at NOTACON.
Post Reply
User avatar
pasdesignal
Posts: 20
Joined: Sat Oct 02, 2010 2:31 am

Automount NFS drive?

Post by pasdesignal »

I running exactly the same setup as puupycrack et al as described over here:

posting.php?mode=post&f=2

Basically its kamikaze 8.09 / NFS mount / mpd etc

Have been trying to automount the nfs drive (which is on a x-wrt based server with a usb harddrive) for a week now and have had no luck.

I am editing the /etc/config/fstab file as so:

config mount
option target /mnt/media
option device 192.168.0.139:/mnt
option fstype nfs
option options rw,nolock
option enabled 1

Am I barking up the right tree?
jeroen94704
Posts: 109
Joined: Sat Feb 13, 2010 4:27 am
Location: Eindhoven, the Netherlands

Re: Automount NFS drive?

Post by jeroen94704 »

I never got automount to work through fstab either, and ended up adding the mount command to my mpd script in init.d
User avatar
pasdesignal
Posts: 20
Joined: Sat Oct 02, 2010 2:31 am

Re: Automount NFS drive?

Post by pasdesignal »

OK, sounds promising.

I don't mind a workaround if thats what it takes.

Could you post an example?

Thanks for your reply.
jeroen94704
Posts: 109
Joined: Sat Feb 13, 2010 4:27 am
Location: Eindhoven, the Netherlands

Re: Automount NFS drive?

Post by jeroen94704 »

This is the script that automatically starts mpd when the router boots. It also mounts the usb drive and the NFS share that contains my music:

/etc/init.d/mpd

Code: Select all

#!/bin/sh /etc/rc.common
# Copyright (C) 2006-2008 OpenWrt.org

START=99
STOP=99

NAME=mpd

start() {
    # Delay so other boot scripts finish running
    sleep 5

    # Expand library path so packages installed on the usb drive can be found
    export LD_LIBRARY_PATH=/usb/packages/usr/lib:/usb/packages/lib 
   
    # Mount the USB drive
    mount -t ext3 /dev/discs/disc0/part2 /usb
   
    # Run portmap, or mounting the NFS share wil take FOREVER
    portmap

    # Mount the NFS share
    mount -t nfs 192.168.0.192:/mnt/bigdata/music /usb/remote 

    # Run mpd
    /usb/packages/usr/bin/mpd /usb/packages/etc/mpd.conf 
} 
Now when you add a symlink to this file in /etc/rc.d/S99mpd, it will run the "start" function in this script automatically upon startup. The command to make a sym link is:

Code: Select all

ln -s /etc/init.d/mpd /etc/rc.d/S99mpd
User avatar
pasdesignal
Posts: 20
Joined: Sat Oct 02, 2010 2:31 am

Re: Automount NFS drive?

Post by pasdesignal »

Thank you.

It works a treat! Now I have mpd running and waiting for my commands everytime I power on.

AWESOME!
Post Reply