Mr Lazy

August 4, 2009

Auto-mount of NFS shares on PC startup

Filed under: NFS,WD TV — Mr Lazy @ 15:06
Tags: , , , ,

I’m saving up for a “proper” NAS, so at the moment I’m running my NFS shares off my main PC.  I don’t keep the PC on 24×7 but the WD TV does tend to stay on and I got tired of either rebooting the WD TV or manually re-mounting the shares if the PC had been re-started for whatever reason.  So, being the lazy type, I automated it, so that whenever the PC starts up it connects to the WD TV and runs the necessary xmount commands.

For this I used a program call ‘plink’ which comes as part of PuTTY

I created a text file containing all my xmount commands and called this wdtv_commands.txt.  I saved it in the PuTTY directory which is probably not logical but it could go anywhere.

I then created a Windows Command Script (.cmd) file on the desktop containing the following two lines:

cd C:\Program Files (x86)\PuTTY
plink.exe wdtv-ssh -pw "" -batch -m wdtv_commands.txt

wdtv-ssh is the name of a PuTTY saved session which simply creates a SSH connection to the WD TV and uses the username of ‘root’

-pw “” tells plink to use a blank password

-batch tells plink to disable interactive prompts

-m tells plink to read commands from a file

I then set up a task in Task Scheduler to run the command script at Windows Startup.  A condition is also set to ensure the PC’s Ethernet is up, and the task is also delayed by one minute to be safe.

Obviously the advantage of putting the script on the desktop is that I can easily run it at any time.

Of course I still have the xmounts on the WD TV, and this way whether my PC restarts or my WD TV restarts, the NFS shares are mounted.  There can be times when the mounts are duplicated on the WD TV, but this does not seem to cause a problem.

On a related subject I created a desktop shortcut to run the ‘showmount’ command that comes with Truegrid NFS.  Again it’s a command script (.cmd) that contains the following line:

CMD /K "C:\Program Files (x86)\Truegrid\showmount.exe"

The ‘/K’ parameter stops the window from closing once the command has completed.



  1. Hey Mr Lazy. I’m new to putty. I can’t log into my WDTV with SSH. I can do it with Putty using regular telnet, but not SSH. As a result, I can’t setup the stuff above, with the username “root”, etc.

    If I try SSH, I get an error message saying Network Error: Connection Refused

    PC is Win 7 x64 Ultimate
    WDTV is Gen1


    Comment by AP — March 7, 2011 @ 02:49

  2. Ha, right after I sent the msg above, I read somewhere that my new TPLink WR-1043ND gigabit Wireless N router won’t do SSH with stock firmware. wth! Can I set putty up without SSH? What would the commands look like?

    Comment by AP — March 7, 2011 @ 02:54

  3. Are you saying the router will not allow the SSH protocol to pass through it? That sounds very odd, are you 100% sure? Have you checked the settings to see if something needs to be enabled?

    Also, from memory I think you need to add SSH to WDLXTV as an app pack – I’m using ext3-boot remember but I’m fairly sure that WDLXTV will not come with SSH so you need to look it up on b-rad’s website. I think it’s dropbear which I couldn’t get on with so I installed OpenSSH. I’m not currently using it so can’t provide any further tips (I tried WDLXTV and then switched back to ext3-boot and lost ssh in the process and I’ve never got round to setting it up again!)

    Anyway, you couldn’t automate this process using plink (putty) and telnet because it will not send the password for a telnet session (ie. you will always have to enter it manually). It’s just the way putty/plink is designed (for security).

    Comment by Mr Lazy — March 7, 2011 @ 13:14

  4. You’re right about another app pack for WDLXTV.

    According to B-Rad, I would have to create an SSH password which cannot be blank. I assume this password change becomes permanent, even for a telnet connection.

    It’s just that I notice in your instructions above, that you used a blank password, with the double quotes. Was that just for the instructions?

    Anyway, I will try dropbear tonight and report back. If I can get this to automate, then my only issue left will be mkv’s with choppy playback if I use external srt files for subtitles. Not the worst problem to have.

    Comment by AP — March 7, 2011 @ 14:18

  5. I think the non-blank password is a restriction added by B-Rad. At the time, my root password was blank but I was/am using ext3-boot. Regardless, a password should always be used.

    Comment by Mr Lazy — March 7, 2011 @ 14:29

  6. Okay all set up. I actually never understood how to setup putty before.

    1. Load the dropbear app from B-Rad onto the USB stick you use on your WDTV. (
    2. Telnet to WDTV and change the password using B-Rad’s instructions at link above.
    3. Download putty. Open it and put in the IP address of the WDTV and choose SSH.
    4. Go to Connection – Data and type in “root” for the username (no quotes).
    5. Go back to Session and save it all as “wdtv-ssh” (no quotes).
    6. From there all of Mr Lazy’s instructions above worked perfectly.

    Comment by AP — March 7, 2011 @ 21:41

  7. Works PERFECTLY as described, thanks!
    AP – I am also using the TPLink WR-1043ND Router with Stock Firmware and it works. You don’t need to hack your router. I am able to stream an uncompressed 1080p Blu-ray disc image over wireless N using this router and NFS Shares. Stoked! My WDTV’s wireless N dongle is approx 15 feet from the router, line of sight.

    Comment by Grant — July 15, 2011 @ 07:29

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a free website or blog at

%d bloggers like this: