Enable NFS Server

From AwkwardTV
Jump to: navigation, search

AppleTV 1.0 software (Or Safe Update 1.1)

  • First we have to setup up the export: To do this we use the nicl command. (the netinfo command line utility) Since netinfo uses the / to separate path components, and we have / characters in the entry we want to create, those / have to be escaped. This is done with the backslash, \, and since we are running in a shell, we need to double them up. After the shell is done examining the command, the string \\/ becomes \/ which is what we need to pass to nicl.
sudo nicl . -create /exports/\\/mnt\\/Scratch\\/Users\\/frontrow

This will create an export for the frontrow users directory. We need to use the /mnt/Scratch/Users/frontrow path instead of /Users/frontrow because /Users/frontrow is actually a link which NFS doesn't like.

  • We can list all of the current exports on your appletv with:
sudo niutil -list . /exports

In our example that should result in something like:

89       /mnt/Scratch/Users/frontrow
  • If we wanted to delete this export we would do this (example):
sudo nicl . -delete /exports/\\/mnt\\/Scratch\\/Users\\/frontrow
  • Once we have our exports set up to our liking we need to start the mountd daemon and the NFS daemon. We would also have to start portmap, but it is already running on the appletv.
sudo /usr/sbin/mountd
sudo /sbin/nfsd -t -u -n 6

These commands start the mount daemon as well as the nfs daemon. The command arguments to nfsd just mean, enable TCP, enable UDP, and start with 6 threads. If you want the nfsd to start automatically, you can add the two commands above to your /etc/rc.local file.

  • If you make changes to your exports you don't need to restart the nfs server. You simply need to notify the mountd daemon to check for changes. You can do this by sending the "1" signal to the running mountd with this command:
sudo kill -1 `cat /var/run/mountd.pid`
  • If you want to check what exports are available on your appletv you can use the showmount command (from your Mac OS X box or Linux)
showmount -e appletv

Where appletv is the name of your Apple TV on your network.

To connect to the Apple TV NFS share from Linux you would type (from Linux):

mkdir /mnt/frontrow
mount -t nfs appletv:/mnt/Scratch/Users/frontrow/ /mnt/frontrow

AppleTV 1.1 software

  • I have not tested this.