Net.mounts

From WikiDLXTV
Revision as of 09:18, 31 October 2013 by Recliq (Talk | contribs)

Jump to: navigation, search

Introduction

WDLXTV enables you to mount remote share as if they were locally connected.

Very important!

To see NFS/CIFS/CDROM/XFS/ReiserFS/NDAS devices, you must either:

  • have a supported drive/flashdisk plugged in for xmounts to appear under Local Drives -> Folders

OR

  • have CIFSINTERCEPTOR enabled and /conf/cifs-interceptor set up with shares to appear under Network Shares

The configuration is done in a file called net.mounts.
net.mounts is a file that can be put on either a USB drive connected to WDTV or in /conf directory on the WDTV itself. It will mount network shares on boot which can then be accessed under Local Drives on the WDTV.


Examples

Example net.mounts to demonstrate options of xmount to be used in auto-mounting of network shares. Note: If you store a net.mounts file in /conf then it will ALSO execute on startup.


Mount a windows file share (must be done by IP address)

xmount "//192.168.0.1/ShareName" "ShareName" cifs

if your "guest" account is disabled, you must supply username and password

xmount "//192.168.0.1/ShareName" "ShareName" cifs "user=username,pass=password"

where 192.168.0.1 is the ip address your host device.


Mount an NFS share

xmount 192.168.0.1:/nfsroot ShareName nfs

Note: some NFS's have problems with the default mount option of UDP. If you have issues playing or listing content, then add proto=tcp as the fourth parameter.

xmount 192.168.0.1:/nfsshare ShareName nfs "proto=tcp"

where 192.168.0.1 is the IP address your host device. Note that Gen 1 uses different syntax for a TCP mount:

xmount 192.168.0.1:/nfsshare ShareName nfs tcp,soft,intr,rsize=32768,wsize=32768


Mount a remote FTP

To find advanced options execute: curlftpfs --help in telnet.

xmount "ftp://192.168.0.1:21" "FTP Name" ftpfs "-o user=UserName:Password"


Mount a remote SSH server

sshfs *requires* keyless login
you can view your public key by executing: ssh-public-key
add your key to a remote machine by executing: ssh-copy-id user@server
to find options execute: sshfs --help

xmount "User@ServerName:Directory" "Server Name"sshfs "-o follow_symlinks"


combine previous xmounts using unionfs

unionfs takes a colon delimited list of 'ShareNames' and aggregates their content to the target directory structure is preserved. The following is an example, it mounts 4 remote shares 'hidden' so they are not visible in the OSD and then aggregates them. you hide an xmount by preceeding its 'ShareName' with a . (dot)

xmount "192.168.0.44:/movies"   ".movies1"  nfs
xmount "192.168.0.233:/stuff"   ".movies2"  nfs
xmount "192.168.0.101:/movies3" ".movies3"  nfs
xmount "192.168.0.151:/videos"  ".movies4"  nfs  
xmount ".movies1:.movies2:.movies3:.movies4"  "ShareUnion"  unionfs


Troubleshooting

IMPORTANT

Always remember linux is case sensitive!! This means it DOES matter and make a difference if you write

//192.168.0.1/ShareName

or

//192.168.0.1/sharename


Find SMB/Samba/CIFS Shares

With your web browser, type in the ip address of the WDTV device to access the Web Frontend. Login with "wdlxtv" for both username and password as default. Click on telnet client to access shell. Login with "root" as username and the default password is blank (blank=empty - It is suggested: change immediately using telnet, as SSH *won't* work!!). You'll see a WDLXTV welcome screen and then a # upon success. Next type this:

smbclient -L 192.168.0.1

where 192.168.0.1 is the ip address your host device.
If you need a username/password combination to access the shares use:

smbclient -L 192.168.0.1 -U <username>

It should give you a listing of the shares on the host device.

# smbclient -L 192.168.1.6
creating lame upcase table
creating lame lowcase table
Enter root's password:
Domain=[ALPHASECTOR] OS=[Unix] Server=[Samba 3.0.37]

        Sharename       Type      Comment
        ---------       ----      -------
        disk1           Disk
        disk2           Disk
        Movies          Disk
        Music           Disk
        IPC$            IPC       IPC Service (Samba Server)
Domain=[ALPHASECTOR] OS=[Unix] Server=[Samba 3.0.37]

        Server               Comment
        ---------            -------
        TRILLIAN             Server
        WDLXTV1              WDLXTV 1
        WDLXTV2              WDLXTV 2
        ZAPHOD               Desktop
 
        Workgroup            Master
        ---------            -------
        ALPHASECTOR          TRILLIAN

As you can see there are four shares that can be mounted: disk1, disk2, Movies and Music.


Find NFS Shares

With your web browser, type in the ip address of the WDTV device to access the Web Frontend. Login with "wdlxtv" for both username and password as default. Click on telnet client to access shell. Login with "root" as username and the default password is blank (blank=empty - It is suggested: change immediately using telnet, as SSH *won't* work!!). You'll see a WDLXTV welcome screen and then a # upon success. Next type this:

showmount -e 192.168.0.1

where 192.168.0.1 is the IP address your host device. it should give you a listing of the NFS exports that available on the server and what IP's are allowed to connect to them like this:

# showmount -e 192.168.0.1
Export list for 192.168.0.1:
/media/MTB            192.168.0.0/24
/media/ext4ster       192.168.0.0/24
/media/biggyfat       192.168.0.0/24
/media/SevenFitty     192.168.0.0/24
/media/fattyOneFive   192.168.0.0/24

The above means that all of the NFS exports are allowed to be mounted by any host in 192.168.0.0 - 192.168.0.255


"No Media" Error

Problem:
The share gets mounted and shows up but when you enter it you get the message No media in the current folder.

Solution:
There is no general way to solve this because this is a very generic message the WDTV displays on various errors. Here are some starting points:

  • When using NFS use TCP instead of UDP connections by adding the proto=tcp option
  • Problems have been reported when Jumbo Frames was enabled on some network cards ([http://forum.wdlxtv.com/viewtopic.php?f=3&t=2608])
  • When enabling a shared directory on a server to mount with your WDTV, make sure you understand where that folder is on your server [1]
  • Very often it's a permissions issue!


Still can't see the mounted share

Problem:
You can see the share using, for example, showmount -e 192.168.0.1.
You run your xmount command and it doesn't return an error message. However, you still can't see your newly xmounted share under the local drives on the WDTV. (Even if you still already have a USB drive plugged in, as mentioned earlier.)

Solution:
Make sure your xmount name is _different_ from your USB drive label name.
ie.
Your USB drive label name is 'Movies'.
Use another mount name! A working NFS xmount command would be in this case :

xmount 192.168.0.1:/nfsroot NotMovies nfs


Check your net.mounts on shell

If your xmounts don't appear after reboot make sure the net.mounts file is correct by executing it in the shell:

sh /path/to/your/net.mounts

This should not return any errors, otherwise you have a syntax error or your xmount command(s) are wrong in some other place. When debugging xmounts make sure you can execute the xmount command line in shell without errors, then transfer this line to the net.mounts file.


Trouble with mounting a share with write permission

Remember: Mounting a share with write support may cause the Spinning Circle Of Doom, SCOD. Use with caution!
If trying to mount a share with write support, i.e.

xmount "//192.168.0.1/ShareName" "ShareName" cifs rw

you may encounter the following error message:

mount: mounting \\192.168.0.1\ShareName on /tmp/media/usb/ShareName failed: Invalid argument
xmount: xmount //192.168.0.1/ShareName ShareName cifs rw FAILED WTF?!?

This is because of a bug in xmount, the default options aren't appended when supplying a user options, (i.e. rw). The workaround is to supply these options. First, run the "usual" xmount command, for mounting the share as readonly:

xmount "//192.168.0.1/ShareName" "ShareName" cifs

You'll get the output

xmount: xmounted //192.168.0.1/ShareName ShareName cifs user=guest,iocharset=utf8,ro

Note the options above and change ro to rw, which will give you the following command:

xmount "//192.168.0.1/ShareName" "ShareName" cifs user=guest,iocharset=utf8,rw

This will hopefully solve your problem. More info can be found here.