LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 5716|回复: 10

关于NIS的 自动挂接HOME目录

[复制链接]
发表于 2005-10-21 16:47:45 | 显示全部楼层 |阅读模式
看了KEVIN老师那贴精华。。还是解决不了。。。
[root@client ~]# cat /etc/auto.master
/home   /etc/auto.home --timeout=60
[root@client ~]# cat /etc/auto.home
*                      -rw,soft,initr                192.168.0.1:/home/&

Oct 21 17:30:39 client automount[8108]: mount_autofs: already mounted
Oct 21 17:30:39 client automount[8108]: /home: mount failed!

我没用VG-HOME 。。可是还是不行。。
[root@client ~]# mount -l
/dev/sda5 on / type ext3 (rw) [/]
none on /proc type proc (rw)
none on /sys type sysfs (rw)
none on /dev/pts type devpts (rw,gid=5,mode=620)
usbfs on /proc/bus/usb type usbfs (rw)
/dev/sda1 on /boot type ext3 (rw) [/boot]
none on /dev/shm type tmpfs (rw)
/dev/sda6 on /home type ext3 (rw) [/home]
/dev/sda2 on /usr type ext3 (rw) [/usr]
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
nfsd on /proc/fs/nfsd type nfsd (rw)

远程没问题。。手动MOUNT HOME目录也没问题
就是AUTOFS不行
而我把不用HOME目录 像精华贴那里那样 用RHOME也是没问题

基本确定是AUTOFS的问题。。可是我autofs挂接别的目录也没问题
就是挂到HOME上不行~~
精华贴看了。。实在解决不了。。。
发表于 2005-10-21 23:53:51 | 显示全部楼层
autofs不能监听在已挂载的文件系统之上。
回复 支持 反对

使用道具 举报

发表于 2005-10-22 21:38:37 | 显示全部楼层
Yes, yongjian is right. autofs不能监听在已挂载的文件系统之上。

In your case, it is obvious if you look carefully at the output of "mount -l":

[root@client ~]# mount -l
.......
/dev/sda6 on /home type ext3 (rw) [/home]
.......


You see, your /home is already mounted on /dev/sda6, which means your /home is a partition instead of a local file system under / .

Just remember that you need to use the workaround /rhome if your "mount -l" or "df -k" shows  your /home is a partition. Then everything OK
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-10-22 22:46:21 | 显示全部楼层
是的。。我开始也发现了这个问题 因为精华贴里面有人提到
单是后面有人说可以挂接多次的
rhome这个 最好的办法是用ln来做
回复 支持 反对

使用道具 举报

发表于 2005-11-1 04:52:18 | 显示全部楼层
One more concernt about this NIS autofs

As we know, autofs不能监听在已挂载的文件系统之上...

If remote client's home is mounted on lvm or raid instead of local file system
under root, the workaround is to create a soft link on SERVER to point /rhome to /home, and edit the /etc/passwd file on SERVER side, change user's /home to /rhome.

If it is in EXAM and you have no control of the NIS server (you can't create a soft link /rhome --> /home and can't edit /etc/passwd to change user's login directory), how can I do????

I tried to find a workaround that only need to modify the CLIENT side, but it doesn't work fine. ...

I tried to create a soft link on CLIENT side called /rhome --> /home, auto.master use /rhome as mount point,  then the client's /home will be mounting to server's /home, but all my client local users' home directory is lost, since the autofs mount just take over the original mount.   

Any clue??? Maybe I think too much?
回复 支持 反对

使用道具 举报

发表于 2005-11-1 23:24:22 | 显示全部楼层
I read all the postings about nis+autofs and did thousands tests. Here is the conclusion:

Case 1: client side /home is not a partition, but just a local file system under /.
            
In this case, you can autofs mount client's /home directly on server's /home, BUT
这样你那些在客户机没有登陆NIS域前的就有的本地用户can't find their their home directory, since client's /home is mounted on server's /home.

Case 2; client side /home is a partition, no access to modify server side to change user's home directory

In this case,  I tried several workarounds, but none of them work fine.

a. Create a soft link on CLIENT side called /rhome --> /home, auto.master use /rhome as mount point, then the client's /home will be using the link /rhome to mount to server's /home, but all my client local users' home directory is lost, since the autofs mount just take over the original mount.

b. Create a sub dir on CLIENT side under /home, for example, /home/nis, auto.master use /home/nis as mount point, but then user log in will complain "can't find /home/user1", because autofs mounted to /home/nis/user1, not /home/user1

To conclude, in both cases, if you don't want to mess up your client's local users /home directory and at the same time want to mount correctly to NIS server's /home directory, you have to have access to SERVER side:

1. On SERVER side,
    ---Create a soft link /rhome to /home, and edit the /etc/passwd file, change user's /home to /rhome, export /home as nfs file system.  
    ---Or simpler, don't create any link.  Just place all nis users under /rhome (useradd -d /rhome/user1 user1), and export /rhome as nfs filesystem.

2. On CLIENT side, no matter /home is a local file system or partition, don't use /home as mount point.  mkdir /rhome and autofs use /rhome

Please correct me if I am wrong
回复 支持 反对

使用道具 举报

发表于 2006-11-30 11:57:36 | 显示全部楼层
好文章,我google了很久,这是唯一一篇解释了为什么:
mount_autofs: already mounted
/home: mount failed!
的原因。
另外我想问一下,我的/home的确是一个partion, 如何将这个partion变成/,然后让让home挂载在/之下?
回复 支持 反对

使用道具 举报

发表于 2007-4-17 15:42:22 | 显示全部楼层
回复 支持 反对

使用道具 举报

发表于 2007-4-17 15:42:27 | 显示全部楼层
回复 支持 反对

使用道具 举报

发表于 2007-4-17 15:42:47 | 显示全部楼层
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表