文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>nfs和autofs

nfs和autofs

时间:2006-07-15  来源:hellwolf

内存实在不够,我的黄金一代硬件之一腾龙III硬盘今天也光荣报销了,FC+xen计划告终——其实成功了,但是FC要用掉只少192M内存,debian只能分到128左右,连个LAMP都吃力,罢了。

台机换回了Debian,Debian的安装程序直接支持LVM2,少了很多麻烦。把以前的cvs,lxr等服务都移植了回来。突然想到本子硬盘紧张,索性再搞个NFS,过程很简单:
apt-get install nfs-user-server

# cat /etc/exports
# /etc/exports: the access control list for filesystems which may be exported
#               to NFS clients.  See exports(5).
/netdisk        cocteau(rw,map_static=/etc/nfs/netdisk.map)

# cat /etc/nfs/netdisk.map
# Mapping for client foobar:
#    remote     local
uid  1-65535       -       # squash these
uid  500        1000

我本子上的hellwolf的uid是500,debian上则是1000,所以做了个uid mapping,静态的。据说NIS动态映射更灵活(显然。。),但懒得整了。

现在就是在本子上mount了,一种方法是写fstab,加个pamconsole选项的话普通用户也可以mount了,不过还是不灵活,如果我脱离了网络,那么访问那个盘会陷入uninterruptable sleep,很恼人。于是想到了autofs,以前没接触过,今天尝尝鲜,
大概看了下文档,简单配之了一下:
$cat /etc/auto.master
#
# $Id: auto.master,v 1.4 2005/01/04 14:36:54 raven Exp $
#
# 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 --timeout=60
#/smb   /etc/auto.smb
#/net   /etc/auto.net

$cat /etc/auto.misc
#
# $Id: auto.misc,v 1.2 2003/09/29 08:22:35 raven Exp $
#
# This is an automounter map and it has the following format
# key [ -mount-options-separated-by-comma ] location
# Details may be found in the autofs(5) manpage

#cd             -fstype=iso9660,ro,nosuid,nodev :/dev/cdrom

# the following entries are samples to pique your imagination
#linux          -ro,soft,intr           ftp.example.org:/pub/linux
#boot           -fstype=ext2            :/dev/hda1
#floppy         -fstype=auto            :/dev/fd0
#floppy         -fstype=ext2            :/dev/fd0
#e2floppy       -fstype=ext2            :/dev/fd0
#jaz            -fstype=ext2            :/dev/sdc1
#removable      -fstype=ext2            :/dev/hdd
mojave          -fstype=nfs             mojave:/netdisk

然后任何时候访问/misc/mojave只要网络可达就会自动mount nfs分区,比较舒服。

另外用网络磁盘跑了下vmware(装2003试了下),速度过得去,本子硬盘省下了阿,这下买CD就不用担心空间越来越小了,哈哈
相关阅读 更多 +
排行榜 更多 +
萌趣贪吃蛇

萌趣贪吃蛇

休闲益智 下载
粘液快跑

粘液快跑

休闲益智 下载
火柴人超级战车安卓版

火柴人超级战车安卓版

飞行射击 下载