Auto FS

Taking care of your Linux box.

Auto FS

Postby mfaisalkh » Mon Mar 14, 2005 1:03 pm

This is Auto FS configuration.


Autofs mounts partitions, NFS & Samba shares and
devices like CDs, on demand. On demand means the
partition is not mounted when system boots but as soon
as you access any of above mentioned shares or devices
or partitions the autofs (automount) autometically
mounts it at run time in back ground. And after a
defined timout period if you don't access that
share/partition/device then autofs umounts it.

Config Files:

1. /etc/auto.master
2. /etc/auto.NAME

Replace NAME with any name you want.

Service:
-------

/etc/rc.d/init.d/autofs

PROCEDURE:

There are two config files

1. /etc/auto.master

In this file we mention the base dirs in which we want
to mount shares/partitions/devices.
Suppose we want to mount all the network shares(NFS &
Samba) in /share dir and Partitions in /partitions dir
and devices(CDROM & Floppy) in /media dir the we will
add the following three entries /etc/auto.master file.

Entries in /etc/auto.maste:

/share /etc/auto.share
/partitions /etc/auto.partitions
/media /etc/auto.media

This tells that there are three main dirs
(/share,/partitions & /media) in which it has to
mount different things and info about what it has to
mount and where to mount and with what options to
mount are present in /etc/auto.share,
/etc/auto.partitions & /etc/auto.media.

Info about what things it has to mount in /share base
dir are present in /etc/auto.share and same thing is
for other two dirs.

Note we must create the main dir (as mentioned in
first field of /etc/auto.master). For example we have
to create "/share", "/partitions" & "/media"

Entries in mount info files (e.g. /etc/auto.share):
---------------------------------------------------

1. /etc/auto.share:
------------------
Suppose we have one NFS share named "/nfs" on a
machine have ip address 192.168.0.12. And a samba
share on machine have 192.168.0.30 ip address and
share name is "smb" and we want to access this samba
share with user id "u1" and samba password of u1 is
"123".
The entries for these two will be.

nfs -rw 192.168.0.12:/nfs
samba -fstype=smbfs,username=u1,password=123
://192.168.0.30/smb

Here nfs and samba (first field) tells auto fs to
create dirs with these names and mount the specifed
shares (defined in 3r field) on them. The 2nd field
tells how to mount and the partition type.

Now save and exit and restart "autofs" service and try
to enter /share/nfs. as soon as we type #cd /share/nfs
command, autofs will autometically creat nfs dir in
/share dir and mount 192.168.0.12:/nfs share on it.
Same it will do with samba.

2. /etc/auto.partitions:
-----------------------

Suppose we have a partition "/dev/hdc3" what we want
to mount on deman (/etc/fstab mounts partitions
permanantly). To mount it we need the following entry.

data -fstype=ext3 :/dev/hdc3

Now save and exit and restart "autofs" service and try
to enter "/partitions/data" as soon as we type "#cd
/partitions/data" command, autofs will autometically
creat data dir in "/partitions" dir and mount
/dev/hdc3 partition on it.

3. /etc/auto.media:
------------------

Suppose we want to mount CDROM on demand and our cdrom
device is /dev/hdb. We will have to write the
following entry.

cd -fstype=iso9660,ro :/dev/hdb

Save and exit and restart "autofs" service. Automount
will create cd dir in /media dir and will mount
/dev/hdb on it as soon as you try to access it.


Kinds Regards,

M.Faisal Khan
mfaisalkh
Havaldaar
 
Posts: 124
Joined: Wed Mar 17, 2004 4:05 pm
Location: Karachi

Return to “%s” Administration

Who is online

Users browsing this forum: No registered users and 1 guest

cron