close

昨天主管轉給我一封母公司的 MIS 寄來的信

裡面問到要設定 Linux 自動掛載 CIFS Share Directory 的設定方法

這邊提到的不是將設定寫在 /etc/fstab 中,在開機時自動掛載方法

而是要使用 AutoFS 的方式。

我上網查了一下,很特別的是要在 // 之前加一個 :

跟掛載 NFS 不一樣,於是特別把測試環境紀錄下來,供日後參考。

 

[root@opsview scan]# cat /etc/auto.master
#
# Sample auto.master file
# This is an automounter map and it has the following format
# key [ -mount-options-separated-by-comma ] location
# For details of the format look at autofs(5).
#
/misc /etc/auto.misc
#
# NOTE: mounts done from a hosts map will be mounted with the
# "nosuid" and "nodev" options unless the "suid" and "dev"
# options are explicitly given.
#
/net -hosts
#
# Include central master map if it can be found using
# nsswitch sources.
#
# Note that if there are entries for /net or /misc (as
# above) in the included master map any keys that are the
# same will not be seen as the first read key seen takes
# precedence.
#

/b /etc/auto.b

+auto.master



[root@opsview scan]# cat /etc/auto.b
scan -fstype=cifs,rw ://192.168.0.88/scan

[root@opsview scan]# service autofs restart


[root@opsview ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_opsview-lv_root 18G 4.0G 13G 25% /
tmpfs 1.9G 72K 1.9G 1% /dev/shm
/dev/sda1 485M 40M 421M 9% /boot
[root@opsview ~]# cd /b/scan
[root@opsview scan]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_opsview-lv_root 18G 4.0G 13G 25% /
tmpfs 1.9G 72K 1.9G 1% /dev/shm
/dev/sda1 485M 40M 421M 9% /boot
//192.168.0.88/scan 732G 681G 52G 93% /b/scan

arrow
arrow
    全站熱搜

    johnchen6927 發表在 痞客邦 留言(0) 人氣()