This article was base on the need of higher storage. Recently i need to divide my web (centos 5.3) and mysql server(Ubuntu 8.04.2) and since mysql server need a higher spec ( high hdd capacity) i set the web server on slightly lower spec server with lower hdd size and memory somekind of “virtual” hard-disk . And therewere a question on my mind how to use the Mysql server high hdd capacity on my web server , i think of mapping on windows OS okay so i need a mounting between server right ? and after some searching i found NFS.
What is NFS ?
NFS stands for Network File System, a file system developed by Sun Microsystems, Inc. It is a client/server system that allows users to access files across a network and treat them as if they resided in a local file directory. For example, if you were using a computer linked to a second computer via NFS, you could access files on the second computer as if they resided in a directory on the first computer. This is accomplished through the processes of exporting (the process by which an NFS server provides remote clients with access to its files) and mounting (the process by which file systems are made available to the operating system and the user).
• 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.
NFS user permissions are based on user ID (UID). UIDs of any users on the client must match those on the server in order for the users to have access. The typical ways of doing this are:
It’s also important to note that you have to be careful on systems where the main user has root access – that user can change UID’s on the system to allow themselves access to anyone’s files. This page assumes that the administrative team is the only group with root access and that they are all trusted. Anything else represents a more advanced configuration, and will not be addressed here.
Okay on NFS you need to set NFS server and NFS client and here is my spec:
– NFS Server
+ Ubuntu 8.04.2
+ ip address : 10.21.0.220
– NFS Client
+ Centos 5.3
+ ip address: 10.21.0.221
1 .Install NFS Server
# sudo apt-get install portmap nfs-kernel-server
2. Config the exports files on /etc/exports
# vi /etc/exports
and add this
– /root/tes was my files directory on NFS server(ubuntu 8.0.2) that i want to mount
– 10.21.0.221 was the NFS client ip address that i want to allow on NFS server
– rw : Allow clients to read as well as write access
– The “fsid=0” option tells the server to use the NFSv4 pseudofilesystem.
– insecure : Tells the NFS server to use unpriveledged ports (ports > 1024).
– no_subtree_check : If the entire volume (/users) is exported, disabling this check will speed up transfers.
if you want to allow all to access the NFS share you add this on /etc/exports
for another example and option you may refer to http://linux.die.net/man/5/exports
Restart the nfs server
If you make changes to /etc/exports on a running NFS server, you can make these changes effective by issuing the command
# exportfs -a
To see the NFS share path and ip you can also use
# showmount -e
To check if NFS have already working or not on your system you can also use this command
# rpcinfo -p
NFS Client (CentOS)
1. Please maksure you have nfs installed on your client server,nfs -utils by default are installed on centOS 5.3
# rpm -qa | grep nfs
2. Create the folder you want to mount and do the mount
# mkdir /root/testing
# mount -t nfs 10.21.0.220:/root/tes /root/testing
3. now you can check it
# df -h
Filesystem Size Used Avail Use% Mounted on
71G 1.4G 66G 3% /
/dev/sda1 99M 18M 77M 19% /boot
tmpfs 506M 0 506M 0% /dev/shm
584G 15G 540G 3% /root/tes