I‘ve netapp NFS server with /data3 as shared directory. I type the following command at Ubuntu Linux to mount the NFS server:
mount fs2:/data3 /nfs/
mount 192.168.1.100:/data3 /nfs/
But I’m getting an error which read as follows:
mount: wrong fs type, bad option, bad superblock on fs2:/data3,
missing codepage or helper program, or other error
(for several filesystems (e.g. nfs, cifs) you might
need a /sbin/mount. helper program)
In some cases useful info is found in syslog – try
dmesg | tail or so
How do I fix this problem?
[click to continue…]
How do I setup NFS v4.0 distributed file system access server under CentOS / RHEL v5.x for sharing files with UNIX and Linux workstations? How to export a directory with NFSv4? How to mount a directory with NFSv4?
[click to continue…]
Q. I’m using CentOS 5 Linux 64 bit version. How do I share directory called /data2 to all other UNIX / Linux computers?
A. NFS (Network file system) is both a protocol and file system for accessing and sharing file systems across a computer network using UNIX and Linux. NFS v4 is used in modern Linux distributions. It offers performance improvements, mandates strong security, and introduces a stateful protocol etc.
How do I export a directory with NFS?
In order to export or share directory called /data2, you need to edit a file called /etc/exports. The file /etc/exports serves as the access control list for file systems which may be exported to NFS clients.:
# vi /etc/exports
Add config directive as follows:
Each line contains an export point and a whitespace-separated list of clients allowed to mount the file system at that point. Each listed client may be immediately followed by a parenthesized, comma-separated list of export options for that client.
- rw – Allow both read and write requests on /data2 NFS volume
- sync – Reply to requests only after the changes have been committed to stable storage
Save and close the file. Restart the nfs service:
# /etc/init.d/nfs restart
NFS client configuration
Client computer need to mount file system using mount command or /etc/fstab file, enter:
# mkdir /mnt/nfs
# mount -t nfs4 nfsserver-name-or-ip:/data2 /mnt/nfs
Read the man page for more configuration options:
$ man exports
Q. How do I access NAS server using NFS? I am using Redhat Linux (RHEL).
NFS (Network File System) is a protocol originally developed by Sun Microsystems.
NFS used by UNIX and Linux oses as a distributed file system which allows a computer/server/workstation to access files over a network.
NFS is a popular file-sharing protocol for Linux and UNIX. NAS (Network attached storage) also supports NFS configuration.
Linux NFS service
In order to use NFS you need to run portmap service and rpc.statd and rpc.lockd daemons. Use following commands to start these services (RedHat/Fedora Linux):
# chkconfig portmap onAssuming that NAS is configured properly you need to type following command to access NAS (please refer our sample configuration diagram):
# chkconfig nfslock on
# /etc/init.d/portmap start
# /etc/init.d/nfslock start
# mkdir /backupLinux supports UDP by default and TCP as an option. TCP may improve performance in some cases (as a side effect it may increase the CPU load on the local server). If you want to use UDP just type following command:
# mount -o tcp 220.127.116.11:/mountpoint /backup
# mount 18.104.22.168:/mount/point /backupYou can also mount NFS share by editing /etc/fstab file:
# vi /etc/fstabAppend following line:
22.214.171.124:/mountpoint /backup nfs defaults 0 0Save the file and exit to shell prompt.Try to pass following values to mount command improve NFS performance:
# mount -t nfs -o nocto, rsize=32768,wsize=32768 126.96.36.199:/mountpoint /backupWhere,
- rsize=32768,wsize=32768:This will make your nfs connection faster than with the default buffer size of 4096. risze is read size and wsize is write size.
- nocto : Suppress the retrieval of new attributes when creating a file.
There are few more options supported to tweak NFS please consult man page of nfs.
A note for FreeBSD users
NFS configuration is a relatively straightforward, all you need to do is open /etc/rc.conf and put following line (FreeBSD client system):
# vi /etc/rc.confAppend following line:
nfs_client_enable="YES"Save the file and use mount command as follows:
# /etc/init.d/nfsclient startThere are few options supported to tweak NFS client under FreeBSD please consult man page of nfs/mount for more information.
# mkdir /backup
# mount 188.8.131.52:/mountpoint /backup