NFS SERVER SETUP ON CETNOS 6.5 / Redhat 6.5 / Fedora

In this tutorial let us see how to install and configure NFS server and how to share files between NFS server and clients. Though i have tested these steps in Cent-OS 6.5 32 bit edition, it will work on RHEL/Fedora/ 64 bit architecture.

Scenario

NFS Server Operating System : CentOS 6.5 64 bit (Minimal server install)

NFS Server Operating System  : CentOS 6.5 64 bit (Minimal server install)

NFS Client Operating System  : CentOS 6.5 64 bit (Desktop Minimal)

NFS Server IP Address              Host rackspace-nfs01: 192.168.58.152

NFS Server IP Address              Host rackspace-nfs02: 192.168.58.153

NFS Client IP Address               Host rackspace-jon: 192.168.58.154

SERVER 01

[root@rackspace-nfs01 ~]# yum install nfs* -y

Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

* base: stingray.cyber.net.pk

* extras: stingray.cyber.net.pk

* updates: stingray.cyber.net.pk

Setting up Install Process

Package nfs-utils-lib-1.1.5-6.el6.x86_64 already installed and latest version

Package 1:nfs-utils-1.2.3-39.el6.x86_64 already installed and latest version

Resolving Dependencies

–> Running transaction check

—> Package nfs-utils-lib-devel.x86_64 0:1.1.5-6.el6 will be installed

–> Processing Dependency: pkgconfig(libgssglue) for package: nfs-utils-lib-devel-1.1.5-6.el6.x86_64

—> Package nfs4-acl-tools.x86_64 0:0.3.3-6.el6 will be installed

–> Running transaction check

—> Package libgssglue-devel.x86_64 0:0.1-11.el6 will be installed

–> Finished Dependency Resolution

 

Dependencies Resolved

 

===================================================================================== Package                                                Arch                                      Version                                        Repository                               Size

=====================================================================================Installing:

nfs-utils-lib-devel                                    x86_64                                    1.1.5-6.el6                                    base                                     67 k

nfs4-acl-tools                                         x86_64                                    0.3.3-6.el6                                    base                                     43 k

Installing for dependencies:

libgssglue-devel                                       x86_64                                    0.1-11.el6                                     base                                     11 k

 

Transaction Summary

=====================================================================================

Install       3 Package(s)

 

Total download size: 121 k

Installed size: 368 k

Downloading Packages:

(1/3): libgssglue-devel-0.1-11.el6.x86_64.rpm                                                                                                                           |  11 kB     00:00

(2/3): nfs-utils-lib-devel-1.1.5-6.el6.x86_64.rpm                                                                                                                       |  67 kB     00:00

(3/3): nfs4-acl-tools-0.3.3-6.el6.x86_64.rpm                                                                                                                            |  43 kB     00:00

——————————————————————————————————————————————

Total                                                                                                                                                          143 kB/s | 121 kB     00:00

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

Installing : libgssglue-devel-0.1-11.el6.x86_64                                                                                                                                          1/3

Installing : nfs-utils-lib-devel-1.1.5-6.el6.x86_64                                                                                                                                      2/3

Installing : nfs4-acl-tools-0.3.3-6.el6.x86_64                                                                                                                                           3/3

Verifying  : nfs4-acl-tools-0.3.3-6.el6.x86_64                                                                                                                                           1/3

Verifying  : nfs-utils-lib-devel-1.1.5-6.el6.x86_64                                                                                                                                      2/3

Verifying  : libgssglue-devel-0.1-11.el6.x86_64                                                                                                                                          3/3

 

Installed:

nfs-utils-lib-devel.x86_64 0:1.1.5-6.el6                                                         nfs4-acl-tools.x86_64 0:0.3.3-6.el6

 

Dependency Installed:

libgssglue-devel.x86_64 0:0.1-11.el6

 

Complete!

 

[root@rackspace-nfs01 ~]# echo 192.168.58.152 rackspace-nfs01 >> /etc/hosts

[root@rackspace-nfs01 ~]# echo 192.168.58.153 rackspace-nfs02 >> /etc/hosts

Now Setup Hosts file on both servers

[root@rackspace-nfs01 ~]# cat /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4

::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.58.152 rackspace-nfs01

192.168.58.153 rackspace-nfs02

 Test Network connections  on Both Servers

[root@rackspace-nfs01 ~]# ping rackspace-nfs01

PING rackspace-nfs01 (192.168.58.152) 56(84) bytes of data.

64 bytes from rackspace-nfs01 (192.168.58.152): icmp_seq=1 ttl=64 time=0.171 ms

64 bytes from rackspace-nfs01 (192.168.58.152): icmp_seq=2 ttl=64 time=0.054 ms

 

[root@rackspace-nfs01 ~]# ping rackspace-nfs02

PING rackspace-nfs02 (192.168.58.153) 56(84) bytes of data.

64 bytes from rackspace-nfs02 (192.168.58.153): icmp_seq=1 ttl=64 time=0.899 ms

64 bytes from rackspace-nfs02 (192.168.58.153): icmp_seq=2 ttl=64 time=0.255 ms

 Now Setup SELinux

[root@rackspace-nfs01 ~]# vi /etc/selinux/config

# This file controls the state of SELinux on the system.

# SELINUX= can take one of these three values:

#     enforcing – SELinux security policy is enforced.

#     permissive – SELinux prints warnings instead of enforcing.

#     disabled – No SELinux policy is loaded.

SELINUX=disabled #(Please disable SE LINUX)

# SELINUXTYPE= can take one of these two values:

#     targeted – Targeted processes are protected,

#     mls – Multi Level Security protection.

SELINUXTYPE=targeted

:wq!

 Stop Iptables Firewall

[root@rackspace-nfs01 ~]# /etc/init.d/iptables stop

iptables: Setting chains to policy ACCEPT: filter          [  OK  ]

iptables: Flushing firewall rules:                         [  OK  ]

iptables: Unloading modules:                               [  OK  ]

 

 

[root@rackspace-nfs01 ~]# /etc/init.d/nfs start

Starting NFS services:                                     [  OK  ]

Starting NFS mountd:                                       [  OK  ]

Starting NFS daemon:                                       [  OK  ]

Starting RPC idmapd:                                       [  OK  ]

 

[root@rackspace-nfs01 ~]# chkconfig nfs on

 

[root@rackspace-nfs01 /]# fdisk -l

 

Disk /dev/sda: 21.5 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00050401

 

Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1          64      512000   83  Linux

Partition 1 does not end on cylinder boundary.

/dev/sda2              64        2611    20458496   8e  Linux LVM

 

Disk /dev/sdb: 5368 MB, 5368709120 bytes

255 heads, 63 sectors/track, 652 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000

 

 

Disk /dev/mapper/vg_rackspacenfs01-lv_root: 18.9 GB, 18865979392 bytes

255 heads, 63 sectors/track, 2293 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000

 

 

Disk /dev/mapper/vg_rackspacenfs01-lv_swap: 2080 MB, 2080374784 bytes

255 heads, 63 sectors/track, 252 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000

 

Create Disk Partition for NFS Server.

[root@rackspace-nfs01 /]# fdisk /dev/sdb

Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel

Building a new DOS disklabel with disk identifier 0x7c08daf5.

Changes will remain in memory only, until you decide to write them.

After that, of course, the previous content won’t be recoverable.

 

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

 

WARNING: DOS-compatible mode is deprecated. It’s strongly recommended to

switch off the mode (command ‘c’) and change display units to

sectors (command ‘u’).

Command (m for help): n

Command action

e   extended

p   primary partition (1-4)

p

Partition number (1-4): 1

First cylinder (1-652, default 1):

Using default value 1

Last cylinder, +cylinders or +size{K,M,G} (1-652, default 652):

Using default value 652

 

Command (m for help): p

 

Disk /dev/sdb: 5368 MB, 5368709120 bytes

255 heads, 63 sectors/track, 652 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x7c08daf5

 

Device Boot      Start         End      Blocks   Id  System

/dev/sdb1               1         652     5237158+  83  Linux

Command (m for help): w

The partition table has been altered!

 

Calling ioctl() to re-read partition table.

Syncing disks.

 

[root@rackspace-nfs01 /]# mkfs.ext4 /dev/sdb1

mke2fs 1.41.12 (17-May-2010)

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

Stride=0 blocks, Stripe width=0 blocks

327680 inodes, 1309289 blocks

65464 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=1342177280

40 block groups

32768 blocks per group, 32768 fragments per group

8192 inodes per group

Superblock backups stored on blocks:

32768, 98304, 163840, 229376, 294912, 819200, 884736

 

Writing inode tables: done

Creating journal (32768 blocks): done

Writing superblocks and filesystem accounting information: done

 

This filesystem will be automatically checked every 39 mounts or

180 days, whichever comes first.  Use tune2fs -c or -i to override.

 

[root@rackspace-nfs01 /]# cd mnt/

[root@rackspace-nfs01 mnt]# ll

total 0

[root@rackspace-nfs01 mnt]# mkdir VD-NFS

[root@rackspace-nfs01 mnt]# ll

total 4

drwxr-xr-x. 2 root root 4096 Jun 21 15:07 VD-NFS

 

[root@rackspace-nfs01 mnt]# mount /dev/sdb1 VD-NFS/

[root@rackspace-nfs01 mnt]# ll

total 4

drwxr-xr-x. 3 root root 4096 Jun 21 15:05 VD-NFS

[root@rackspace-nfs01 mnt]# df -hT

Filesystem                            Type   Size  Used Avail Use% Mounted on

/dev/mapper/vg_rackspacenfs01-lv_root ext4    18G  3.7G   13G  23% /

tmpfs                                 tmpfs  495M     0  495M   0% /dev/shm

/dev/sda1                             ext4   485M   34M  426M   8% /boot

/dev/sdb1                             ext4   5.0G  138M  4.6G   3% /mnt/VD-NFS

 

Add  New Partition Exntry into FSTAB for Auto Mount

[root@rackspace-nfs01 ~]# vi /etc/fstab

#

# /etc/fstab

# Created by anaconda on Sat Jun 21 11:40:09 2014

#

# Accessible filesystems, by reference, are maintained under ‘/dev/disk’

# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info

#

/dev/mapper/vg_rackspacenfs01-lv_root /                       ext4    defaults        1 1

UUID=a741a110-4272-485b-adcc-53467856dec3 /boot                   ext4    defaults        1 2

/dev/mapper/vg_rackspacenfs01-lv_swap swap                    swap    defaults        0 0

tmpfs                   /dev/shm                tmpfs   defaults        0 0

devpts                  /dev/pts                devpts  gid=5,mode=620  0 0

sysfs                   /sys                    sysfs   defaults        0 0

proc                    /proc                   proc    defaults        0 0

/dev/sdb1               /mnt/VD-NFS             ext4    defaults        0 2

:wq!

 Now Setup Exports on NFS Server

[root@rackspace-nfs01 mnt]# vi /etc/exports

/mnt/VD-NFS 192.168.58.152 (rw,sync,no_root_squash,no_all_squash)

 

[root@rackspace-nfs01 mnt]# /etc/init.d/nfs restart

Shutting down NFS daemon:                                  [  OK  ]

Shutting down NFS mountd:                                  [  OK  ]

Shutting down RPC idmapd:                                  [  OK  ]

Starting NFS services:  exportfs: No options for /mnt/VD-NFS 192.168.58.152: suggest 192.168.58.152(sync) to avoid warning

exportfs: No host name given with /mnt/VD-NFS (rw,sync,no_root_squash,no_all_squash), suggest *(rw,sync,no_root_squash,no_all_squash) to avoid warning

[  OK  ]

Starting NFS mountd:                                       [  OK  ]

Starting NFS daemon:                                       [  OK  ]

Starting RPC idmapd:                                       [  OK  ]

 

Next we  need to mount NFS Server exports on NFS Client.

[root@rackspace-jon ~]# mount -t nfs 192.168.58.152:/mnt/VD-NFS /mnt/

[root@rackspace-jon ~]# df -HT

Filesystem                          Type   Size  Used Avail Use% Mounted on

/dev/mapper/vg_rackspacejon-lv_root ext4    19G  3.9G   14G  22% /

tmpfs                               tmpfs  519M     0  519M   0% /dev/shm

/dev/sda1                           ext4   508M   36M  447M   8% /boot

192.168.58.152:/mnt/VD-NFS          nfs    5.3G  145M  4.9G   3% /mnt

Great we can mount successfully.

[root@rackspace-jon mnt]# mount

/dev/mapper/vg_rackspacejon-lv_root on / type ext4 (rw)

proc on /proc type proc (rw)

sysfs on /sys type sysfs (rw)

devpts on /dev/pts type devpts (rw,gid=5,mode=620)

tmpfs on /dev/shm type tmpfs (rw,rootcontext=”system_u:object_r:tmpfs_t:s0″)

/dev/sda1 on /boot type ext4 (rw)

none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)

sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)

192.168.58.152:/mnt/VD-NFS on /mnt type nfs (rw,vers=4,addr=192.168.58.152,clientaddr=192.168.58.154)

 

Add NFS Shares on Client Machines for Auto mount

[root@rackspace-jon ~]# vi /etc/fstab

#

# /etc/fstab

# Created by anaconda on Sat Jun 21 12:15:50 2014

#

# Accessible filesystems, by reference, are maintained under ‘/dev/disk’

# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info

#

/dev/mapper/vg_rackspacejon-lv_root /                       ext4    defaults        1 1

UUID=6b1625d0-3022-4dad-adb0-d237c148ad48 /boot                   ext4    defaults        1 2

/dev/mapper/vg_rackspacejon-lv_swap swap                    swap    defaults        0 0

tmpfs                   /dev/shm                tmpfs   defaults        0 0

devpts                  /dev/pts                devpts  gid=5,mode=620  0 0

sysfs                   /sys                    sysfs   defaults        0 0

proc                    /proc                   proc    defaults        0 0

 

192.168.58.152:/mnt/VD-NFS /mnt/                        nfs     rw,sync,hard,intr       0 0

:wq!

Now we can reboot NFS client Machine & verify next boot time nfs Share Automatically mounted.

[root@rackspace-jon ~]# init 6

Great we have  done successfully.

 

SERVER 02

[root@rackspace-nfs02 ~]# yum install nfs* -y

Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

* base: mirrors.ispros.com.bd

* extras: mirrors.ispros.com.bd

* updates: mirrors.ispros.com.bd

Setting up Install Process

Package nfs-utils-lib-1.1.5-6.el6.x86_64 already installed and latest version

Package 1:nfs-utils-1.2.3-39.el6.x86_64 already installed and latest version

Resolving Dependencies

–> Running transaction check

—> Package nfs-utils-lib-devel.x86_64 0:1.1.5-6.el6 will be installed

–> Processing Dependency: pkgconfig(libgssglue) for package: nfs-utils-lib-devel-1.1.5-6.el6.x86_64

—> Package nfs4-acl-tools.x86_64 0:0.3.3-6.el6 will be installed

–> Running transaction check

—> Package libgssglue-devel.x86_64 0:0.1-11.el6 will be installed

–> Finished Dependency Resolution

 

Dependencies Resolved

 

=====================================================================================

Package                                                Arch                                      Version                                        Repository                               Size

=====================================================================================

Installing:

nfs-utils-lib-devel                                    x86_64                                    1.1.5-6.el6                                    base                                     67 k

nfs4-acl-tools                                         x86_64                                    0.3.3-6.el6                                    base                                     43 k

Installing for dependencies:

libgssglue-devel                                       x86_64                                    0.1-11.el6                                     base                                     11 k

 

Transaction Summary

=====================================================================================

Install       3 Package(s)

 

Total download size: 121 k

Installed size: 368 k

Downloading Packages:

(1/3): libgssglue-devel-0.1-11.el6.x86_64.rpm                                                                                                                           |  11 kB     00:00

(2/3): nfs-utils-lib-devel-1.1.5-6.el6.x86_64.rpm                                                                                                                       |  67 kB     00:00

(3/3): nfs4-acl-tools-0.3.3-6.el6.x86_64.rpm                                                                                                                            |  43 kB     00:00

——————————————————————————————————————————————

Total                                                                                                                                                           46 kB/s | 121 kB     00:02

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

Installing : libgssglue-devel-0.1-11.el6.x86_64                                                                                                                                          1/3

Installing : nfs-utils-lib-devel-1.1.5-6.el6.x86_64                                                                                                                                      2/3

Installing : nfs4-acl-tools-0.3.3-6.el6.x86_64                                                                                                                                           3/3

Verifying  : nfs4-acl-tools-0.3.3-6.el6.x86_64                                                                                                                                           1/3

Verifying  : nfs-utils-lib-devel-1.1.5-6.el6.x86_64                                                                                                                                      2/3

Verifying  : libgssglue-devel-0.1-11.el6.x86_64                                                                                                                                          3/3

 

Installed:

nfs-utils-lib-devel.x86_64 0:1.1.5-6.el6                                                         nfs4-acl-tools.x86_64 0:0.3.3-6.el6

 

Dependency Installed:

libgssglue-devel.x86_64 0:0.1-11.el6

 

Complete!

 

[root@rackspace-nfs02 ~]# echo 192.168.58.153 rackspace-nfs02 >> /etc/hosts

[root@rackspace-nfs02 ~]# echo 192.168.58.152 rackspace-nfs01 >> /etc/hosts

 

 

[root@rackspace-nfs02 ~]# cat /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4

::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.58.153 rackspace-nfs02

192.168.58.152 rackspace-nfs01

 

[root@rackspace-nfs02 ~]# ping rackspace-nfs01

PING rackspace-nfs01 (192.168.58.152) 56(84) bytes of data.

64 bytes from rackspace-nfs01 (192.168.58.152): icmp_seq=1 ttl=64 time=1.66 ms

64 bytes from rackspace-nfs01 (192.168.58.152): icmp_seq=2 ttl=64 time=0.275 ms

 

[root@rackspace-nfs02 ~]# ping rackspace-nfs02

PING rackspace-nfs02 (192.168.58.153) 56(84) bytes of data.

64 bytes from rackspace-nfs02 (192.168.58.153): icmp_seq=1 ttl=64 time=0.055 ms

64 bytes from rackspace-nfs02 (192.168.58.153): icmp_seq=2 ttl=64 time=0.043 ms

 

[root@rackspace-nfs02 ~]# vi /etc/selinux/config

# This file controls the state of SELinux on the system.

# SELINUX= can take one of these three values:

#     enforcing – SELinux security policy is enforced.

#     permissive – SELinux prints warnings instead of enforcing.

#     disabled – No SELinux policy is loaded.

SELINUX=disabled  #(Please disabled SELINUX)

# SELINUXTYPE= can take one of these two values:

#     targeted – Targeted processes are protected,

#     mls – Multi Level Security protection.

SELINUXTYPE=targeted

 

[root@rackspace-nfs02 ~]# /etc/init.d/iptables stop

iptables: Setting chains to policy ACCEPT: filter          [  OK  ]

iptables: Flushing firewall rules:                         [  OK  ]

iptables: Unloading modules:                               [  OK  ]

 

Make New Partition on NFS02

[root@rackspace-nfs02 ~]# fdisk -l

Disk /dev/sda: 21.5 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x0008ecd3

Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1          64      512000   83  Linux

Partition 1 does not end on cylinder boundary.

/dev/sda2              64        2611    20458496   8e  Linux LVM

Disk /dev/sdb: 5368 MB, 5368709120 bytes

255 heads, 63 sectors/track, 652 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000

Disk /dev/mapper/vg_rackspacenfs02-lv_root: 18.9 GB, 18865979392 bytes

255 heads, 63 sectors/track, 2293 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000

Disk /dev/mapper/vg_rackspacenfs02-lv_swap: 2080 MB, 2080374784 bytes

255 heads, 63 sectors/track, 252 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000

 

[root@rackspace-nfs02 ~]# fdisk /dev/sd

sda   sda1  sda2  sdb

[root@rackspace-nfs02 ~]# fdisk /dev/sdb

Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel

Building a new DOS disklabel with disk identifier 0x30daeb2e.

Changes will remain in memory only, until you decide to write them.

After that, of course, the previous content won’t be recoverable.

 

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

 

WARNING: DOS-compatible mode is deprecated. It’s strongly recommended to

switch off the mode (command ‘c’) and change display units to

sectors (command ‘u’).

 

Command (m for help): n

Command action

e   extended

p   primary partition (1-4)

p

Partition number (1-4): 1

First cylinder (1-652, default 1):

Using default value 1

Last cylinder, +cylinders or +size{K,M,G} (1-652, default 652):

Using default value 652

 

Command (m for help): p

 

Disk /dev/sdb: 5368 MB, 5368709120 bytes

255 heads, 63 sectors/track, 652 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x30daeb2e

 

Device Boot      Start         End      Blocks   Id  System

/dev/sdb1               1         652     5237158+  83  Linux

 

Command (m for help): w

The partition table has been altered!

 

Calling ioctl() to re-read partition table.

Syncing disks.

Create File System.

[root@rackspace-nfs02 ~]# mkfs.ext4 /dev/sdb1

mke2fs 1.41.12 (17-May-2010)

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

Stride=0 blocks, Stripe width=0 blocks

327680 inodes, 1309289 blocks

65464 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=1342177280

40 block groups

32768 blocks per group, 32768 fragments per group

8192 inodes per group

Superblock backups stored on blocks:

32768, 98304, 163840, 229376, 294912, 819200, 884736

 

Writing inode tables: done

Creating journal (32768 blocks): done

Writing superblocks and filesystem accounting information: done

 

This filesystem will be automatically checked every 30 mounts or

180 days, whichever comes first.  Use tune2fs -c or -i to override.

 

[root@rackspace-nfs02 ~]# cd /mnt/

[root@rackspace-nfs02 mnt]# ll

total 0

[root@rackspace-nfs02 mnt]# mkdir HD-NFS

[root@rackspace-nfs02 mnt]# ll

total 4

drwxr-xr-x. 2 root root 4096 Jun 21 16:24 HD-NFS

[root@rackspace-nfs02 mnt]# mount /dev/sdb

sdb   sdb1

[root@rackspace-nfs02 mnt]# mount /dev/sdb1 HD-NFS/

[root@rackspace-nfs02 mnt]# df -hT

Filesystem                            Type   Size  Used Avail Use% Mounted on

/dev/mapper/vg_rackspacenfs02-lv_root ext4    18G  3.7G   13G  23% /

tmpfs                                 tmpfs  495M     0  495M   0% /dev/shm

/dev/sda1                             ext4   485M   34M  426M   8% /boot

/dev/sdb1                             ext4   5.0G  138M  4.6G   3% /mnt/HD-NFS

 

Add entry for Auto Mount of New Partition in FSTAB

[root@rackspace-nfs02 ~]# vi /etc/fstab

#

# /etc/fstab

# Created by anaconda on Sat Jun 21 11:44:34 2014

#

# Accessible filesystems, by reference, are maintained under ‘/dev/disk’

# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info

#

/dev/mapper/vg_rackspacenfs02-lv_root /                       ext4    defaults        1 1

UUID=2638509e-735f-479b-964e-e6b61806dc97 /boot                   ext4    defaults        1 2

/dev/mapper/vg_rackspacenfs02-lv_swap swap                    swap    defaults        0 0

tmpfs                   /dev/shm                tmpfs   defaults        0 0

devpts                  /dev/pts                devpts  gid=5,mode=620  0 0

sysfs                   /sys                    sysfs   defaults        0 0

proc                    /proc                   proc    defaults        0 0

 

/dev/sdb1               /mnt/HD-NFS             ext4    defaults        0 2

 

Great we can reboot NFS02 Server and Verify next Boot time the partition will be auto mounted.

 

Configure NFS02 Server

[root@rackspace-nfs02 ~]# vi /etc/exports

/mnt/HD-NFS 192.168.58.153 (rw,sync,no_root_squash,no_all_squash)

 

[root@rackspace-nfs02 ~]# /etc/init.d/nfs restart

Shutting down NFS daemon:                                  [  OK  ]

Shutting down NFS mountd:                                  [  OK  ]

Shutting down NFS services:                                [  OK  ]

Shutting down RPC idmapd:                                  [  OK  ]

Starting NFS services:  exportfs: No options for /mnt/HD-NFS 192.168.58.153: suggest 192.168.58.153(sync) to avoid warning

exportfs: No host name given with /mnt/HD-NFS (rw,sync,no_root_squash,no_all_squash), suggest *(rw,sync,no_root_squash,no_all_squash) to avoid warning

[  OK  ]

Starting NFS mountd:                                       [  OK  ]

Starting NFS daemon:                                       [  OK  ]

Starting RPC idmapd:                                       [  OK  ]

 

 

 

Next we can mount Second NFS Share on NFS Client.

[root@rackspace-jon ~]# mount -t nfs 192.168.58.153:/mnt/HD-NFS newmnt/

[root@rackspace-jon ~]# df -hT

Filesystem                          Type   Size  Used Avail Use% Mounted on

/dev/mapper/vg_rackspacejon-lv_root ext4    18G  3.6G   13G  22% /

tmpfs                               tmpfs  495M     0  495M   0% /dev/shm

/dev/sda1                           ext4   485M   34M  426M   8% /boot

192.168.58.152:/mnt/VD-NFS          nfs    5.0G  138M  4.6G   3% /mnt

192.168.58.153:/mnt/HD-NFS          nfs    5.0G  138M  4.6G   3% /newmnt

Great we can mount second NFS share successfully.

[root@rackspace-jon ~]# mount

/dev/mapper/vg_rackspacejon-lv_root on / type ext4 (rw)

proc on /proc type proc (rw)

sysfs on /sys type sysfs (rw)

devpts on /dev/pts type devpts (rw,gid=5,mode=620)

tmpfs on /dev/shm type tmpfs (rw,rootcontext=”system_u:object_r:tmpfs_t:s0″)

/dev/sda1 on /boot type ext4 (rw)

none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)

sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)

192.168.58.152:/mnt/VD-NFS on /mnt type nfs (rw,sync,hard,intr,vers=4,addr=192.168.58.152,clientaddr=192.168.58.154)

192.168.58.153:/mnt/HD-NFS on /newmnt type nfs (rw,sync,hard,intr,vers=4,addr=192.168.58.153,clientaddr=192.168.58.154)

 

We can Configure Auto mount second NFS Share.

[root@rackspace-jon ~]# vi /etc/fstab

#

# /etc/fstab

# Created by anaconda on Sat Jun 21 12:15:50 2014

#

# Accessible filesystems, by reference, are maintained under ‘/dev/disk’

# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info

#

/dev/mapper/vg_rackspacejon-lv_root /                       ext4    defaults        1 1

UUID=6b1625d0-3022-4dad-adb0-d237c148ad48 /boot                   ext4    defaults        1 2

/dev/mapper/vg_rackspacejon-lv_swap swap                    swap    defaults        0 0

tmpfs                   /dev/shm                tmpfs   defaults        0 0

devpts                  /dev/pts                devpts  gid=5,mode=620  0 0

sysfs                   /sys                    sysfs   defaults        0 0

proc                    /proc                   proc    defaults        0 0

 

192.168.58.152:/mnt/VD-NFS /mnt/                        nfs     rw,sync,hard,intr       0 0

192.168.58.153:/mnt/HD-NFS /newmnt/               nfs     rw,sync,hard,intr      0 0

 

Next we create Backup Shell Script.

 

[root@rackspace-jon ~]# vi /etc/cron.daily/backup-NFS1.sh

#!/bin/bash

#Purpose = Backup of Important Data

#Created on 24-June-2014

#Author = Muhammad Zeeshan Bhatti

#Version 1.0

#START

 

TIME=`date +”%d-%m-%y(%T)”`             # This Command will add date in Backup File Name.

FILENAME=”backup-$TIME.tar.gz”      # Here i define Backup file name format.

SRCDIR=”/tmp”                       # Location of Important Data Directory (Source of backup).

DESDIR=”/mnt/BACKUP-NFS1″           # Destination of backup file.

tar -cpzf $DESDIR/$FILENAME $SRCDIR

#END

:wq!

 

[root@rackspace-jon ~]#  vi /etc/cron.daily/backup-NFS2.sh

#!/bin/bash

#Purpose = Backup of Important Data

#Created on 24-June-2014

#Author = Muhammad Zeeshan Bhatti

#Version 1.0

#START

 

TIME=`date +”%d-%m-%y(%T)”`             # This Command will add date in Backup File Name.

FILENAME=”backup-NFS2-$TIME.tar.gz”      # Here i define Backup file name format.

SRCDIR=”/tmp”                       # Location of Important Data Directory (Source of backup).

DESDIR=”/newmnt/BACKUP-NFS2″           # Destination of backup file.

tar -cpzf $DESDIR/$FILENAME $SRCDIR

#END

:wq!

Next we can Create CRON Job for Automatic Backup Job Running every 4 Hours leter.

[root@rackspace-jon ~]# crontab -e

0 4,12,20 * * *  /bin/bash /etc/cron.daily/backup-NFS1.sh

0 8,16,0 * * * /bin/bash /etc/cron.daily/backup-NFS2.sh

 

Automatically backup successfully generated  on NFS1

[root@rackspace-jon ~]# ll /newmnt/BACKUP-NFS2/

total 384220

-rw-r–r–. 1 root root 393434160 Jun 22 15:56 backup-NFS2-22-06-14(16:00:01).tar.gz

 

 Automatically backup successfully generated  on NFS1

[root@rackspace-jon ~]# ll /mnt/BACKUP-NFS1/

total 384216

-rw-r–r–. 1 root root 393435154 Jun 22 18:25 backup-22-06-14(19:00:01).tar.gz

37 Replies to “DevOps Training Introduction (UrduCBT)”

  1. What i don’t realize is in truth how you are not actually much more smartly-favored than you might be now.
    You are so intelligent. You recognize thus significantly relating to this subject, made me for my part imagine it from numerous varied angles.
    Its like women and men aren’t involved unless it is something to accomplish with Girl
    gaga! Your own stuffs outstanding. At all times take care of it up!

  2. Прослушивать да и загрузить приятную музыку на нашем сайте http://muz-aven.ru/music/migos%20motorsport%20feat%20nicki%20minaj%20cardi%20b жанра
    музыка топ 20, музыка ностальжи и танцевальная музыка online (be out
    of mind, кадебостани mind if i, split mind, ed sheeran perfect cover,
    ed sheeran perfect слова, in my mind dynoro, pixies where is my mind скачать, wolves selena gomez marshmello скачать бесплатно, mind pro,
    post malone rockstar ft savage, скачать рингтон kadebostany mind if i stay, post
    malone rockstar мп3, shes on my mind jp cooper, oh wonder white,
    post malone rockstar цензура, слова песни mind your
    mind, the weeknd starboy kygo remix скачать, on my mind goulding, havana
    camila cabello cover, mind of mine альбом, скачать песню justin timberlake supplies, post
    malone 21 savage rockstar record mix, dua lipa idgaf скачать, ed sheeran andrea bocelli perfect, flo rida
    in my mind, ed sheeran perfect зайцев нет, niall horan too much to ask, скачать песню mama
    jonas blue feat william, to come to one’s mind, balvin feat willy williams mi gente, empire state of mind jay z alicia, justin timberlake chris stapleton say something, zayn dusk till dawn минус), camila
    cabello havana 320 kbps, you ve been on my
    mind, pizza twirling through my mind, mind fuck,
    zayn malik dusk till dawn скачать, shawn mendes mercy скачать бесплатно, dua lipa blow your mind mwah, алсу always on my mind, в
    мп3 даром.
    На нашем сайте каждый современный гражданин, абсолютно
    не зависимо от собственных музыкальных требований,
    вполне может найти себе музыкальные произведения согласно нраву.
    Самым главным плюсом этого web-сайта считается тот факт,
    что для скачивания так же проигрывания любимых мелодических песен
    направления Фрикбит, Эсид-хаус, Кереми, Futurepop, Современная индийская классическая музыка, Азан, Хэппи-хардкор, Восточная Европа,
    Месса, Инди-рок и песни direct matt van i don t mind, havana camila cabello минус, off my mind, superhot mind control delete, светлана лобода твои глаза скачать бесплатно mp3, рингтон лобода твои глаза в хорошем
    качестве, песня pentatonix hallelujah, speak ones mind,
    музыка sick boy the chainsmokers, скачать на звонок zayn dusk till dawn,
    post malone rockstar romanescu codrin, рабочая тетрадь super
    minds, charlie puth how long new song, blow your mind скачать бесплатно
    mp3, песня back to you louis tomlinson,
    keniia lost your mind, песня rockstar post malone feat 21 savage, cambridge english in mind, selena gomez wolves на русском, i keep my mind, скачать песню selena gomez
    marshmello wolves, светлана лобода твои
    глаза remix, песня never mind, open mind скачать
    бесплатно, скачать песню kadebostany mind if, david guetta justin bieber 2u
    скачать, oh wonder ultralife, лобода и вахтанг твои глаза, ozuna x romeo santos el farsante remix,
    post malone rockstar crankdat re crank, harry styles sign of the times, crash mind over mutant игры, post malone rockstar скачать
    320 kbps, lady gaga a yo, mind the word order, вовсе не требуется совершать долгую
    процедуру регистрации на веб-сайте
    или посылать различные смс, подобно как это случается на других музыкальных web-ресурсах.

  3. Hello There. I foumd your blog the use of msn. That is a very
    well written article. I’ll be sure to bookmak it and return tto reqd xtra of your
    useful information. Thank yoou for the post. I’ll definitely comeback.

  4. I have to thank you for the efforts you’ve put in writing this site.

    I’m hoping to check out the same high-grade content from you in the future as well.
    In fact, your creative writing abilities has inspired me to get my
    own, personal website now 😉

  5. Greetings! I’ve been reading your weblog for a while nnow and finally got the braveryy to go ahead and give you a
    shout out from Atascocita Texas! Just wanted to tell you keep up the good job!

  6. Right here is the right web sikte for everyone who would like to understand thiks topic.
    You realize a whole lot its almost tough to argue with you (not
    that I personally will nesed to…HaHa). You certainly put
    a neww spin on a subject that’s been written about for decades.
    Excellent stuff, just wonderful!

  7. Have yyou ever thought about adding a little bit more than just your articles?
    I mean, what you say is valuable and everything. Nevertheless think about if you added some great pictures or
    videos to give your posts more, “pop”! Your content is
    excellent but with images and clips, this website could certainly be
    one of the greatest inn its niche. Terrific blog!

  8. Hi, I believe your site could possibly be having browser compatibility problems.
    Whenever I take a look at your site in Safari, it looks
    fine however when opening in Internet Explorer,
    it’s got some overlapping issues. I just wanted to give
    you a quick heads up! Besides that, wonderful blog!

  9. Can I simply say what a comfort to find somebody who truly knows
    what they are talking about on the net. You actually understand how to
    bring an issue to light and make it important.
    More people need to read this and understand this side
    of the story. I can’t believe you’re not more popular because you
    definitely have the gift.

  10. I have been exploring for a little for any high-quality articles or
    blog posts on this sort of area . Exploring in Yahoo I
    finally stumbled upon this web site. Reading this
    info So i am happy to express that I’ve an incredibly just right uncanny feeling I discovered
    just what I needed. I so much no doubt will make sure
    to don?t omit this web site and provides it a glance
    regularly.

  11. Hey there, I think your website might be having browser compatibility issues.
    When I look at your blog in Safari, it looks fine but when opening in Internet Explorer,
    it has some overlapping. I just wanted to give you a quick heads up!
    Other then that, fantastic blog!

  12. IT услуги, обслуживание офиса, компьютерных сетей ✓ Комплексный подход, выгодные цены, гарантия качества ☎ (044) 536-25-40, (098) 996-25-40

  13. Hoԝdy! I know this is kind of off topic but I was wondering which blog platform are you using fⲟr this website?
    I’m getting fed up of WordPress beсause I’ve had issues with hacҝers and
    I’m looking at alternatives for another platform.
    I would be awesome if you could point me іn the direction of a good platform.

  14. My brother recommended I might like this website.
    He was totally right. This post actually made my day. Youu can not imagine just how
    much time I had spent for this information!
    Thanks!

  15. You still have your own identity, nevertheless the decisions that you just make will now involve someone
    else at the same time, rather than affecting only yourself.
    If you are facing any in the above given problem then you must
    contact Kelley counseling, at for professional family counseling.
    In both cases of couple counseling Boston and couple counseling dc, an essential part in the revenue is committed
    to various donations for charities.

Leave a Reply

Your email address will not be published.