Difference between revisions of "NFS file server (MIPSel)"
Latest revision as of 02:21, 23 July 2006
Installing an NFS Server
|Be careful what you are doing and don't blame me. But feel free to correct or extend.|
If you share network drives in a Unix like network, you should prefer NFS over Samba, as it keeps file attributes in place. To install a NFS Server on a LinkStation, I succeeded with the following steps. It was done on a MIPSel LinkStation, but should work on a PPC version similar. I did everything on a Debian machine as I do not allow Windows an Internet connection.
- A LinkStation with root-access
- NFS Software binaries
Root access is handled elsewhere.
For the NFS binaries I downloaded the following packages from my closest Debian mirror:
PPC users should look for the PPC versions of the files.
Prepare the Software
We want to create an archive we can unpack in the LinkStation root directory, which puts all files in their correct places. So we create an empty working directory "nfs", which holds our target file-structure. We can create the sub-directories below that or copy them from the Debian files.
If you have Midnight Commander installed, just step into the Debian files and copy from the contents directory what you need into that directory with the complete path. I left out the man pages, etc. You can also convert the Debian files with alien to another format.
I had to adjust some files:
- "/etc/rc0.d" does not exist on the LinkStation, you have to move that to "/etc/rc.d/rc0.d". You can adjust the links inside, if you like it clean.
- create an "/etc/exports" file for your exported shares
Check for all files and directories for their ownership and access rights.
- To Do - need the "/var/*" files, they are a potential risk for LinkStation file-system, as /var is a link there, that can be broken
Pack Your Files
In your "nfs" directory type:
tar cvzf ../nfs_mypackage_mipsel.tgz .
and transfer the package to your LinkStation
Open a telnet connection to your LinkStation and be root. Then enter the following. But stop, read first this:
The ""k"" or ""--keep-old-files"" option to "tar" is important, as the "/var" in the archive is a real directory, but the "/var" on the LinkStation is a link to "mnt/ram/var" which is gone, when you just untar the package.
The ""w"" or ""--interactive"" option asks you for confirmation before each file. This is a good idea for the first try.
cd / tar kwxvzf /mnt/hda/share/nfs_mypackage_mipsel.tgz
Start the Server
cd /etc/init.d ./portmap start ./nfs-common start ./nfs-user-server start
These should run auto-magically, when you reboot your LinkStation. But you do not have to, now.
With a correct /etc/exports file you should be able to mount from another machine with an NFS client. See my example exports file in the "tarball" and adjust your network.
Connect from a Client
On your client you just enter (replace "<ls>" with your LinkStation IP address or name):
mount -t nfs <ls>:/mnt/hda/share /mnt
and you should see the contents with ls /mnt. To have a permanent mount you have to edit your /etc/fstab and find a better place than /mnt. Add the following line (one line) to your /etc/fstab:
havelock:/mnt/hda/share /nfs/havelock nfs timeo=14,intr,rsize=8192,wsize=8192,soft
Add "noauto" if you do not want an automount at boot time.
This is a first try, which is not perfect. So here is the list, what has to be done:
- I do not like the "/var/*" directories in the package. Anybody with NFS knowledge out there to tell us, if we need them?
- UID, GID on client and server are different, but that is another project.
- as what user should the server run? Now it is root, we have no kernel-server
- I removed the showmount and nfsstat. I think they need kernel-nfs
- investigate "2 Gigabyte Filesize" limit.
Comments and corrections needed and welcome.