Showing posts with label NFS. Show all posts
Showing posts with label NFS. Show all posts

Friday, March 3, 2017

NFS mount on Solaris 11 Non-Global zones

In this post, we would learn how we mount one folder from one Non-Global zone to another zone on Solaris 11 operating system.

As you know, in linux server it is less difficult in comparision to Solaris server. Here, I will take a two local zone "sun01" & "sun02". Let's take an example, we will mount one folder named "/export/backup" from "sun01" local zone to another zone "sun02" on "/project/export/data" location.

Step by Step method of NFS mount on Solaris 11:

1. In the first step we will create the directory on "sun02" zone where we want to mount the folder. 

sun02#mkdir /project/export/data

2. In second step, we will make a configuration for this process. So for this work you need to login on global zone with root access and make an entry on the dfstb configuration file.

sun#vi /etc/dfs/dfstab

share -F nfs -o rw=sun02 /zones/sun01/root/export

If you see the above entry, we have provided the read/write access to directory on sun02 server where we mount the folder from sun01 local zone.

3. In next step you need to login on sun02 server and mount the shared folder using below command.

sun02#mount sun:/zones/sun01/root/export/backup /project/export/data

4. Once you run the above command the folder is mount from one local zone to another zone temprarily. You can go to the directory and verify that the data which is listed on /export/backup folder is show on sun02 directory.

5. In the last step you need to restart the NFS service on the global zone so the configuration files and other changes makes affect. But these configuration are available until we are not taking reboot of the zone.

Please comment on the post, if you have any issue regarding the NFS mount sharing process. I will try to resolve such issue as soon as possible.

Wednesday, February 15, 2017

Step by Step NFS Server and Client Configuration in HP-UX

In this post, I will explain step by step method of NFS server and client configuration on HP-UX operating system. Network File System is a distriubted file system which allows a client computer to access a file system that shared on another computer’s or server's.

NFS server is configured on the server locally on attached physically disk. On my HP-UX server i will configured the NFS server and for client you can use same HP-UX operating machine or other linux machine.

We can used the below NFS server IP and client IP on my own HP-UX machine and Linux machine.

NFS Server : 10.135.0.27 and share folder /backup
NFS Client : 10.135.0.2 and mount point /home/backup

Steps involved to configure the NFS Server:

1. First we will make sure both NFS server(10.135.0.27) and client(10.135.0.2) are accessible. After that we will make an entry in /etc/hosts or Configure it in DNS to resolve the IP if you use server name instead of IP address. But in our case we will use IP address instead of name.

hpx:/>vi /etc/hosts

10.135.0.27 hpxnfsserver
10.135.0.2 hpxnfsclient

The /etc/hosts entry would we same on both server and client machine so it can be accessible to each other.


2. In second step we will identify the folder to be export from server to the client. On my HP-UX server machine, I am going to export the folder /backup.

3. Now we will change the shared folder permission, normally we don't provide the read/write access to shared folder but in my case for testing purpose i will provide the (777) permission so that NFS client user can read/write the data on shared folder.

hpx:/>#chmod 777 /backup

4. In this step we change the NFS_SERVER=1 to enable your server to act as a NFS Server in the configuration file /etc/rc.config.d/nfsconf

hpx:/>vi /etc/rc.config.d/nfsconf
Change the NFS_SERVER parameter as follow.
NFS_SERVER=1
PCNFS_SERVER=0
START_NFSLOGD=0
START_MOUNTD=1
MOUNTD_OPTIONS=""
Save and exit the file.

5. In final step we will add an entry of our shared folder in the export file /etc/dfs/dfstab with proper permission.

#vi /etc/dfs/dfstab
/usr/sbin/share -F nfs -o rw -d “Test directory” /backup

Save and exit the file.

If you see the above line "/backup is shared folder and we will provide the "rw" read/write access to this folder.

6. Now please restart the nfs service on NFS server and make it permanent so after reboot of HP-UX server the shared folder is not umount.

hpx:/>/sbin/init.d/nfs.server stop
hpx:/>/sbin/init.d/nfs.server start

7. Using below command we can check the NFS folder is shared or not and also we can ensure which client can access this machine.

hpx:/>/usr/sbin/exportfs -av

shareall -F nfs

Steps involved to access the NFS shared folder to the NFS clients:

1. Now for NFS client configuration i will login on my Linux machine.In my case i will use my Centos machine as a client, You can select your NFS client machine as per your requirement.

2. On client machine, please select the mount point to where we have to mount the NFS shared folder /backup which we exported from NFS Server 10.135.0.27. On my Linux machine, I will mount it on /home/backup.

3. In this step we will verify the list of shares available on client machine. Please use the below "showmount" command to check which NFS shared folder is accessible.

hpx:/>showmount -e 10.135.0.27
export list for 10.135.0.27
/backup

If we get the output, server side export configuration doesnt have any problem between nfs server and client.

3. In next step we will mount the nfs share locally on our desintation mount point folder.

hpx:/>mount 10.135.0.27:/backup /home/backup

4. In final step, you can check the NFS mount folder using "bdf" command. It is show you the mount folder where all existing data is store. For testing purpose you can create any file on /home/backup.

Hope, you will like my this post, it is cover all the installation and configuration part step by step. Please let me know if you encouter any issue during NFS configuration on HP-UX machine.

Friday, February 10, 2017

How to setup NFS Server on CentOS 7 / RHEL 7

In this post, I would explain you , how to setup NFS server on CentOS 7 & RHEL 7. This step by step installation and configuration method of NFS server is work in Fedora 22 version also.

Network File System is used for to share files and folders between Linux / Unix systems. NFS enables you to mount a remote share locally as well as it allows to have updated files across the share.

Before starting the setup method , we need to understand which service and files are used for NFS setup.

Please find the below services which are used for NFS setup. its must be always runs on operating system.

rpcbind service: The rpcbind server is used to converts RPC program numbers into universal addresses.

nfs-server service:  Its enables the NFS clients to access NFS shares.

nfs-lock / rpc-statd service: these are the recovery services when an NFS server crashes and reboots.

nfs-idmap service: It translates user and group ids into names, and to translate user and group names
into ids.

The mail configuration file for NFS server and client is "/etc/exports". It controls which file systems are exported to remote hosts and specifies options.

Now, we will start the step by step process for setup of NFS server on CentOS 7 / RHEL 7.

NFS Server Setup:

1. First we need to install the NFS packages on the server where we want to setup of NFS server. We can install the required NFS packages using YUM.

#yum install nfs-utils libnfsidmap

It's installed all the required packages on NFS server.

2. Once the packages are installed we will enable and start all the above services which we explain in my post.

#systemctl enable rpcbind
#systemctl enable nfs-server
#systemctl start rpcbind
#systemctl start nfs-server
#systemctl start rpc-statd
#systemctl start nfs-idmapd

You can check the status of all these service by using this command "systemctl status service_name" to ensure all are working fine.

3. Now we will created the shared directory which we want to share for client.

#mkdir /backup
#chmod -R 777 /backup

We can change the permission of NFS folder as per your requirement. In my case I'll provide the read write permession to all NFS client on this shared folder, so they can easily copy and remove the files. Ideally for security purpose we never provide 777 permission.

4. In this step we will make an entry of shared folder and client information , what permission we give to client to access the folder and which client can access the NFS shared folder.

# vi /etc/exports

/backup 10.135.0.27(rw,sync,no_root_squash)

In above command output, you can see the "/backup" is shared NFS server folder and "10.135.0.27" user client have rights to access this shared folder.

Also in brackets if you see the permission parameter which is very important when we setup the NFS setup. Please find the small idea about these permission parameteres.

rw: Writable permission to shared folder

sync:  all changes to the according filesystem are immediately flushed to disk.

no_root_squash: By default, any file request made by user root on the client machine is treated as by user nobody on the server. If no_root_squash is selected, then root on the client machine will have the same level of access to the files on the system as root on the server

5. Now, we will export the shared directories using following command.

# exportfs -r

We can use other syntax as well for this, which is listed below.

exportfs -v : Displays a list of shares files and export options on a server
exportfs -a : Exports all directories listed in /etc/exports
exportfs -u : Unexport one or more directories
exportfs -r : Reexport all directories after modifying /etc/exports

6. Now in above step 5, we configured and installed the NFS server but if firewall is running on your machine then we need to add NFS services in firewall as well.

#firewall-cmd --permanent --zone public --add-service mountd
#firewall-cmd --permanent --zone public --add-service rpc-bind
#firewall-cmd --permanent --zone public --add-service nfs
#firewall-cmd --reload

NFS Client Steup:

1. Once we installed the NFS server, now we will mount the remote file system on NFS client machine. So for this , on client machine we will install the same NFS packages which we installed during NFS server setup.

#yum install nfs-utils libnfsidmap

It's installed all the required packages on NFS client. Once the packages is installed on NFS client machine we will start the "rpcbind" services on client machine.

#systemctl enable rpcbind
#systemctl start rpcbind

2. Now we will mount the NFS shared folder on client machine but before doing that we will check on client machine which NFS server is available.


client# showmount -e 10.135.0.27    (10.135.0.2 is myserver machine IP)

Export list for 10.135.0.27:
/backup      10.135.0.2

So you can able to see on client machine our NFS shared folder is available on 10.135.0.27 NFS server. 

3. In this step , now we will mount this NFS shared folder on NFS client machine, for this we will create a mount point on client machine where we mount the server shared folder.

client# mkdir /mnt/backup
client#mount 10.135.0.27:/backup /mnt/backup

So you can check the mount folder using "df -h" command.

4. To make a permanent entry on client machine so that once you take a reboot of client machine , the shared folder is not umount.

client# vi /etc/fstab
10.135.0.27:/backup/ /mnt/backup nfs rw,sync,hard,intr 0 0

Please make an entry permanent on client machine and save it and take a restart of machine , after reboot once you login you will see the shared folder still available on the client machine.

5. For testing of shared folder, you can create a one file on client machine then check on the server this newly created file is shown on the server folder also.

So, using all these steps you can easily setup the NFS server and client on your machine.

Monday, January 9, 2017

Solaris local zone not booting "zoneadm: zone 'zone_name': call to zoneadmd failed"

Hello Friends,

In this post, I will explain you the one important issue which we generally facing while we boot the local Solaris zone on the Sun Solaris operating system.

When you are trying to boot the local zone from your Global zone, you encounter the below error message as mentioned below.

Error: zoneadm: zone 'sunz1': "/usr/lib/fs/zfs/mount das/sunz1/export /zones/sunz1/root/export" failed with exit code 1
zoneadm: zone 'sunz1': call to zoneadmd failed.



Solution: For such type of issue is normally related to NFS. When you boot the server, it will start NFS service before start zones. so, as NFS is started, FS /zones/sunz1/root/export  is already in use so global zone doesn't want to start a zone with a FS already in use by a process. You can check which file system is mounted on your global zone as describe below.

sun:/> cat /etc/dfs/dfstab

#       Place share(1M) commands here for automatic execution
#       on entering init state 3.
#
#       Issue the command 'svcadm enable network/nfs/server' to
#       run the NFS daemon processes and the share commands, after adding
#       the very first entry to this file.
#
#       share [-F fstype] [ -o options] [-d "<text>"] <pathname> [resource]
#       .e.g,
#       share  -F nfs  -o rw=engineering  -d "home dirs"  /export/home
share -F nfs -o rw=sun.vibhor.com:sunz1.vibhor.com /zones/sunz2/root/export

In above output you can see one folder is NFS mounted on the two local zone.

2. Now for resolving the issue , please stop the NFS service, boot the zone and restart the service.

sun:/> svcs status nfs/server
STATE          STIME    FMRI
online          5:13:30 svc:/network/nfs/status:default
online          5:13:36 svc:/network/nfs/server:default

Currently NFS server service is online on the Global zone, so using below command we will disable the service.

sun:/> svcadm disable nfs/server

sun:/> svcs status nfs/server
STATE          STIME    FMRI
disabled        5:21:57 svc:/network/nfs/server:default
online          5:13:30 svc:/network/nfs/status:default

3. Now we will boot the local zone again and see the existing error occur or not.

sun:/> zoneadm -z sunz1 boot

Note: Now your local zone is boot without any error. So normally this problem occur when NFS is mounted on the server.

4. Once the issue has been resolved you may enable the NFS server services.

sun:/> svcadm enable nfs/server

sun:/> svcadm restart nfs/server











If you see the my screen output images the whole method is describe step by step. If you facing still issue please comment on this post.