Sunteți pe pagina 1din 4

RH135-Day14

Written by Razib Shahriar Rubence

Mounting NFS Filesystem (Linux-to-Linux) or CIFS Share (Common Internet File Share,
for example Linux-to-Windows)

Mounting NFS Filesystem or CIFS share means to make a remote NFS (Network File Sharing
LINUX-to-LINUX Sharing)
filesystem as though it were a local file system.

Three Basic steps for accesssing a network share (Linux-to-Linux Share)

1. Identify the remote share to access

# showmount -e nfsserver.domain   (for NFS file share)


# smbclient -L cifsserver.domain  (for CIFS share)

2. Determine the mount point where it should be mounted and create the mount point's
directory

# mkdir /remote1
# mkdir /remote2

3. Mount the network file system with appropriate command

# mount nfsserver.domain:/exported/path /remote1  (for NFS file share)


# mount //cifsserver.domain/sharefolder /remote2  (for CIFS share)

/etc/fstab can be used to specify persistent network mounts

# vim /etc/fstab

nfsserver.domain:/exported/path    /remote1    nfs    defaults   0  0


cifsserver.domain/sharefolder      /remote2    cifs   defaults   0  0

Practice LAB:

mount the /var/ftp/pub directory presistently from server1.example.com in /extra directory

- Check the remote share access

# showmount -e server1.example.com

- Create the /extra directory

1/4
RH135-Day14

Written by Razib Shahriar Rubence

# mkdir /extra

- Mount the nfs share

# mount server1.example.com:/var/ftp/pub /extra

- make fstab entry

# vim /etc/fstab

server1.example.com:/var/ftp/pub   /extra   nfs   defaults  0 0

Automaticaly Mount Network Storage:

Creating entry in /etc/ftab (as mantioned above) will keep connection to network server active
always. Alternatively

, the automounter or autofs service can be configured to mount network shares "on demand"
and unmount after a

certain amount of inactivity. There is two ways to configure the automounter service.

Special Map / Net

By default, with the autofs service running whenever you enter (that means cd) to the
/net/nfsserver.domain

directory you'll get the all NFS exports available from that NFS server. Once the directories
underneath stop being

used, the shares become unmounted and the nfsserver.domain subedirectory in /net is
removed.

Practice LAB:

- Check the remote share access

# showmount -e server1.example.com

- Make sure autofs service is running

# service autofs status


# service autofs restart; checkconfig autofs on

- Check the /net directory

2/4
RH135-Day14

Written by Razib Shahriar Rubence

# ls /net  <-- you'll see the directory is empty. because still we didnt browse into this directory

- Enter into /net/server1.example.com

# cd /net/server1.example.com
# ls      <---- you'll see all exported directory from server1.example.com

- change the directory

# cd ~
# ls /mnt/   <--- you'll get nothing in this folder

Indirect Map:

Indirect Maps allow the system administrator to identify a particular network share and
determine the mount point in

any directory as his wish (unlike direct MAP where the mount point is always /net directory)

Indirect maps use a two tier configuration file syntax.

01. /etc/auto.master    <-- This file exists


02. /etc/auto.demo      <-- This file need to be created

- /etc/auto.master will have one line for each "parent" directory to manage and the name of an
individual second

configuration file (i.e, /etc/auto.demo)

# cat /etc/auto.master

/demo  /etc/auto.demo

- /etc/auto.demo file contains the sub-directory (for example public) mount point and network
share with mount

opttions

# cat /etc/auto.demo

public -ro nfsservername.domain:/exported/path

* Students are advised to follow page 101 and 10 for more detail

3/4
RH135-Day14

Written by Razib Shahriar Rubence

Practice LAB:

nfs server with shares:  server1.example.com


the share directory is:  /var/ftp/pub

Configure your workstation such that autofs automaticaly mounts that share as: /special/oshu

- Add the following lines to /etc/auto.master

/special   /etc/auto.special

- Create /etc/auto.special with following line

# vim /etc/auto.special

oshu  -ro    server1.example.com:/var/ftp/pub

- Restart the automounter

# service autofs restart; checkconfig autofs on

4/4

S-ar putea să vă placă și