www.debianadmin.com/network-file-system-nfs-server-and-client-configuration-in-debian.html
Network NFS was developed at a time when we weren't able to share our drives like we are able to today - in the Windows environment. It offers the ability to share the hard disk space of a big server with many smaller clients. While this seems like a standard service to offer, it was not always like this. In the past, clients and servers were unable to share their disk space. Thin clients have no hard drives and thus need a "virtual" hard-disk. The NFS mount their hard disk from the server and, while the user thinks they are saving their documents to their local (thin client) disk, they are in fact saving them to the server. In a thin client environment, the root, usr and home partitions are all offered to the client from the server via NFS. Some of the most notable benefits that NFS can provide are: Local workstations use less disk space because commonly used data can be stored on a single machine and still remain accessible to others over the network. There is no need for users to have separate home directories on every network machine. Home directories could be set up on the NFS server and made available throughout the network. Storage devices such as floppy disks, CDROM drives, and Zip drives can be used by other machines on the network. This may reduce the number of removable media drives throughout the network. The user-mode NFS server in the "nfs-user-server" package is slower but more featureful and easier to debug than the kernel-mode server. A Debian NFS client needs # apt-get install nfs-common portmap while a Debian NFS server needs # apt-get install nfs-kernel-server nfs-common portmap NFS Server Configuration NFS exports from a server are controlled by the file /etc/exports. Each line begins with the absolute path of a directory to be exported, followed by a space-seperated list of allowed clients. Wildcards are allowed in names, as are netmasks (eg /24) following IP addresses, but should usually be avoided for security reasons. A client specification may be followed by a set of options, in parenthesis. It is important not to leave any space between the last client specification character and the opening parenthesis, since spaces are intrepreted as client seperators. If you make changes to /etc/exports on a running NFS server, you can make these changes effective by issuing the command: # exportfs -a NFS Client Configuration NFS volumes can be mounted by root directly from the command line. Of course, for this to work, the directory /mnt/nfs must exist on the client and the server must have been configured to allow the client to access the volume. It is more usual for clients to mount NFS volumes automatically at boot-time. NFS volumes can be specified like any others in /etc/fstab. NFS Performance Tuning NFS does not need a fast processor or a lot of memory. I/O is the bottleneck, so fast disks and a fast network help. If you use IDE disks, use hdparam to tune them for optimal transfer rates. If you support multiple, simultaneous users, consider paying for SCSI disks; SCSI can schedule multiple, interleaved requests much more intelligently than IDE can. On the software side, by far the most effective step you can take is to optimize the NFS block size. If the chunks are too small, your computers spend more time processing chunk headers than moving bits. If the chunks are too large, your computers move more bits than they need to for a given set of data. To optimize the NFS block size, measure the transfer time for various block size values. Here is a measurement of the transfer time for a 256 MB file full of zeros. Try writing with block sizes of 1024, 2048, 4096, and 8192 bytes (if you use NFS v3, you can try 16384 and 32768, too) and measuring the time required for each. In order to get an idea of the uncertainly in your measurements, repeat each measurement several times. In order to defeat caching, be sure to unmount and remount between measurements. It may occur that, like mine, your data do not indicate a clear optimum, but instead seem to approach an asymptote as block size is increased. In this case, you should pick the lowest block size which gets you close to the asymptote, rather than the highest available block size; anecdotal evidence indicates that too large block sizes can cause problems. Once you have decided on an rsize and wsize, be sure to write them into your clients' /etc/fstab. Important points Hard or Soft Link Soft mounts cause data corruption, that I have never tried them. When you use hard, though, be sure to also use intr, so that clients can escape from a hung NFS server with a Ctrl-C. Udp or Tcp Protocol Most admins usually end up using udp because they use Linux servers, But if you have BSD or Solaris servers, by all means use TCP, as long as your tests indicate that it does not have a substantial, negative impact on performance. NFS v2 or NFS v3 NFS v2 and NFS v3 differ only in minor details. While v3 supports a non-blocking write operation which theoretically speeds up NFS, in practice I have not seen any discernable performance advantage of v2 over v3. Still, I use v3 when I can, since it supports files larger than 2 GB and block sizes larger than 8192 bytes. rsize and wsize options in fstab file See the section on performance tuning below for advise of choosing rsize and wsize. An NFS server trusts an NFS client to enfore file access permissions. Therefore it is very important that you are root on any box you export to, and that you export with the insecure option, which would allow any old user on the client box arbitrary access to all the exported files.
March 13th, 2007 at 12:25 pm Hi, As the Debian NFS maintainer, I have to say I'm a bit disappointed at the quality of this article; I can't address them all in too great detail, but a few points are (and I hope the website doesn't mess up my list :-) ): * You do not install things with apt-get unless you really know what you're doing; For one, it supports NFSv4, which the article for some reason doesn't cover at all. Soft mounts do not cause data corruption just by themselves; it has to be combined with some kind of outage (like a network outage). In fact, NFSv4 only lets you use TCP, which is a good thing. I appreciate people writing articles on difficult topics, but please, make a better job of checking your facts first instead of copying them blindly from man pages or old versions of package descriptions.
March 13th, 2007 at 12:57 pm Steinar, This is off topic, however I was wondering why you recommend using aptitude over apt-get? I'd always thought that aptitude was just a frontend to apt-get and have never used it (when I came to debian years ago from RedHat/Slackware apt-get seemed like the best thing in the world) so I was wondering if I'm missing something important?
Debian Admin All Trademarks are the property of their respective owners. The contents of this website may not be mirrored or archived without the express written permission of DebianAdmin Site Owner. DISCLAIMER: All the information, troubleshooting methods, utilities offered in this website is provided AS-IS, without any warranties. Though I strive for perfection, and always test the validity and effectiveness of the troubleshooting content in various systems, I assume no responsibility for your use of these Fixes, Utilities and other troubleshooting advice. The author will not be liable for any special, incidental, consequential or indirect damages due to loss of data or any other reason. Changes to the existing content and new additions are made to this website periodically, without notification.
|