HDTV and Kodi in your living room - based on Nvidia VDPAU, VDR and Ubuntu Linux

Automount of NFS-Shares

In most domestic installation nowadays there are several computers in use. Each one with a special place for a distinct kind of media. A desktop pc has the pictures from last holiday. The videos are already converted and placed on a NAS. Recorded videos from several VDRs are distributed around the house. How fine would it be to have access to all of these everytime. It could be done by sharing them across the network. But now the problems begin. NFS-static mounts are only established during startup of a workstation. But what if the server is not ready at the time. Autofs-based mounts circumvince that. Mounts are only established as they are needed by the client. But what if the server shuts down or the server becomes available after the first attempt to access. All these solution have a general problem: they do not really take into account what the server actually offers. The definitions are made on the client.

Insertion of a new computer into my landscape forces me to reconfigure my complete home-based installation. To use it I have to change each client definition. This is not what I want to.

Here comes a new idea originally raised from Apple and called Zeroconf. The specification is free and a Linux implementation is available. It's called Avahi. This vdr addon now implements support for avahi for vdr.

The following howto should provide information how to use it with vdr, install it and make local adaptations. The implementation was done on yaVDR. But it is usable on any debian-based vdr installation.

How it works

Each host holding some interesting data that could be shared has to broadcast its services. This can simply be achieved by a text-based service definition and a daemon that performs the broadcasting. Service-definition files are placed in /etc/avahi/service. The format is explained later. The broadcast is done from avahi-daemon which is an installation dependency of the addon and should be started automatically.

The addon comes with a set of predefined services each exporting a subdirectory of /srv. /srv should be exported for NFS-usage via /etc/exports which is the standard for yaVDR. Other types of VDR-installation should adapt the service definitions to local conditions. Example entry in /etc/exports could be:

/srv     *(rw,sync,no_subtree_check,all_squash)

Everything that should be necessary on the client is starting the script avahi-mounter. The addon comes with an upstart-definition that should do that automatically. If not check with:


service avahi-mounter start


that it's running.

 

Installation

Installation is easy. Provided that you already have yaVDR in your installation repository list a:


sudo apt-get install vdr-addon-avahi-mounter


should do everything for you. In case you embarrasingly do not have yaVDR in your repository list you can find more info here:


launchpad.net/~yavdr/+archive/testing-vdr

Note that this installation has to be done uniquely on both server and client. If the client should not do any mounts the script has to be configured for that (see Configuration).

After a restart of the workstation the mounts should be there. A good tool for analyzing is avahi-discover (part of avahi-tools, should already be installed). It gives you a list of all exposed services on the network like this:

Services

Every path on your computer that should be shareable by others is called a service and is described in a distinct file. The addon package already comes with a set of predefined services. The description is done in a xml-based file like this:

<?xml version="1.0" standalone='no'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">Recordings on %h</name>
<service>
       <type>_nfs._tcp</type>
       <port>2049</port>
       <txt-record>path=/srv/vdr/video.00</txt-record>
       <txt-record>subtype=vdr</txt-record>
</service>
</service-group>

This is the service description of the standard (yaVDR-) video directory. It is placed in /etc/avahi/services and the filename must end with ".service". For one services adjust the parameter accordingly.

 

ParameterDescription
nameUnique name for the service. The name is not used from yaVDR, but usefull for problem detection, e.g. with avahi-discover. The wildcard "%h" is replaced with the hostname.
type, portStandard type and port parameter. Do not change.
pathPath to the directory that should be exposed to the network.
subtype

Subtype of the service. Significant subtypes for yaVDR are:

  • audio
  • picture
  • video
  • vdr
All mounts are established beneath /media. Subtype vdr get also a link to /srv/vdr/video.00

Configuration

The are only a few configuration options supported at the moment. The default configuration is placed in /etc/default/avahi-mounter. Just copy the file to

/var/lib/vdr/.avahi-mounter

an make your changes there. Options are:

 

ParameterDescription
enabledThe script is started by upstart. The daemon can be disabled here. Usefull for pure server installations.
mediaBase path for the mounts.
vdrBase path for links to mounts of subtype vdr.


Copyright © 2010 yaVDR. This page was last updated on 2011-03-08.