Connecting to a NAS Device

These instructions are specifically for connecting a Networked Attached Storage (NAS) device (such as the Buffalo LinkStation) to the Mini-ITX server. It assumes the NAS device is running Samba with shared directories.

Note - this is not the same as connecting an external (USB) hard drive

This might be useful if you have stored files on a NAS that you want applications on the Mini-ITX server to have access to. (For example you might have your music files located on the NAS and have SqueezeCenter running on the Mini-ITX server).

Installing Samba Client:

The Samba utility that was included during the initial installation allows Clark Connect to share local directories with other computers, but for C-C to be able to interrogate remote Samba shared directories (e.g. those located on a NAS), a utility called Samba Client needs to be installed.

Login using PuTTY, and enter:

apt-get update
apt-get clean
apt-get install samba-client

To Automatically Mount the NAS Share:

To have your NAS automatically detected when it is present on your network and automatically mounted to your server you can use the auto-mount package (see the "Mount a USB Drive" page). This is by far the best option, but takes a little more effort to initially set up.

First install the autofs package (see the "Mount a USB Drive" page for details)

Login with WinSCP and double click on the '/etc/auto.master' file to edit and add the following line to the bottom of the file:

/mnt/NAS       /etc/auto.nas         --timeout=5 --ghost

See here for an example

Then create a file /etc/auto.nas either by navigating to the /etc directory with WinSCP and selecting "File-New-File...", or from PuTTY enter:

touch /etc/auto.nas

With WinSCP, double click on the '/etc/auto.nas' file to edit and add the following line to the bottom of the file:

share_name1     -fstype=smbfs,guest,rw         ://xxx.xxx.xxx.xxx/share_name1

share_name2     -fstype=smbfs,guest,rw         ://xxx.xxx.xxx.xxx/share_name2

See here for an example

See how you can include multiple shares in this file, each share will have an individual directory created at /mnt/NAS/, (obviously replace xxx.xxx.xxx.xxx with the IP address of the NAS device and 'share_name1, 2,...' with the names of the shared folders on the NAS device).

Then for this to take effect restart the autofs service, with PuTTY enter:

service autofs restart

The benefit of this method is the NAS will only be mounted to the server when it is present and required, after a period of inactivity (the --timeout=5 command) the NAS is automatically un-mounted until it is required again.

To Temporarily Mount the NAS Share:

First create a directory for the location of the NAS shared directory on the Mini-ITX server, I chose to put it in the conventional '/mnt' directory and call it 'NAS', enter:

mkdir /mnt/NAS

Now change the permissions of the directory so everyone has read write access, enter:

chmod -R 777 /mnt/NAS

You can mount the NAS share directory with the following command (replace xxx.xxx.xxx.xxx with the IP address of the NAS device and 'share_name' with the name of the shared folder on the NAS device):

mount -t smbfs -o guest,rw //xxx.xxx.xxx.xxx/share_name /mnt/NAS

You should them be able to navigate to the shared directory via /mnt/NAS/ using WinSCP or PuTTY. This will remain mounted until the server is either rebooted or the following command is entered:

umount -a -t smbfs //xxx.xxx.xxx.xxx/share_name /mnt/NAS

To Permanently Mount the NAS Share (without autofs):

First create a directory for the location of the NAS shared directory on the Mini-ITX server, I chose to put it in the conventional '/mnt' directory and call it 'NAS', enter:

mkdir /mnt/NAS

Now change the permissions of the directory so everyone has read write access, enter:

chmod -R 777 /mnt/NAS

If your NAS is always going to be switched on and present on your network, you can set the server to mount the shares during server boot.

Login with WinSCP and double click on the '/etc/fstab' file to edit and add the following line to the bottom of the file:

//xxx.xxx.xxx.xxx/share_name     /mnt/NAS     smbfs     guest,rw     0     0

Remember to press 'Return' after the line - it will fail to mount at boot if you don't.

Note: The NAS has to be present on the network when you switch on your server, if the NAS is added to the network after the initial boot it will not be seen. To re-run the fstab script (so the NAS drive can be mounted), you have to login using PuTTY and enter:

mount -a