1¡¢Àí½ânfs·þÎñÆ÷ºÍ¿Í»§¶Ë¹¦ÄÜ¡£
nfsÊÇsun¹«Ë¾À´½¨Á¢À´Ê¹ÓÃtcp/ipÐÒéÒÔ¼°sunµÄÔ¶³Ìµ÷ÓúÍÍⲿÊý¾Ý±íʾ¹æ·¶µÄ²úÆ·¡£nfsµÄʹÓ÷dz£·½±ã£¬Ò²±È½Ï¿É¿¿¡£Ëû¾ßÓÐÔÚ²»Í¬²Ù×÷ϵͳ֮¼ä¹²ÏíÎļþµÄÄÜÁ¦¡£
nfs·þÎñÆ÷¿ÉÒÔʹÓÃnfsÀ´ÈÃÆäËûÔ¶³Ì»úÆ÷¹²ÏíËüµÄ±¾µØ×ÊÔ´¡£nfs¿Í»§»úÊÇ·ÃÎÊnfs·þÎñÆ÷µÄ¹²Ïí×ÊÔ´µÄ»úÆ÷¡£ÆäʵÔÚʵ¼Ê¹¤×÷ÖУ¬Ò»Ì¨Ö÷»ú¼´¿ÉÒÔÊÇnfs·þÎñÆ÷£¬Ò²¿ÉÒÔÊÇnfs¿Í»§»ú¡£ËûÃÇ¿ÉÒÔ»¥Ï๲ÏíºÍ·ÃÎÊ¡£
Ö»ÒªÄãÄÜÀí½ânfs·þÎñÆ÷ºÍnfs¿Í»§»úÖ®¼äµÄ²»Í¬¡£Ê£ÏµľͺÜeasyÁË¡£
2¡¢ nfs·þÎñÆ÷ºÍnfs¿Í»§»úÇø±ð¡£
2¡¢1 solarisʹÓ÷ֲ¼Ê½Îļþϵͳ»òdfsÃüÁÏí×ÊÔ´¡£¹«Ïí×ÊÔ´¿ÉÒÔÊÖ¶¯ºÍ×Ô¶¯ÉèÖá£
nfs·þÎñÆ÷ÔËÐÐÁ½¸öÊغî½ø³Ì£ºmountd ºÍ nfsd¡£
Óõ½µÄÎļþÊÇ£º
/etc/dfs/dfstab
/etc/dfs/sharetab
/etc/rmtab
nfs·þÎñÆ÷ʹÓÃÃüÁîÊÇ£ºshare unshare shareall unshareall
nfs¿Í»§»úÉÏÔËÐеÄÊغî½ø³ÌÊÇ£ºstatd ºÍ lockd¡£
Óõ½µÄÎļþÊÇ£º
/etc/vfstab
/etc/mnttab
nfs¿Í»§»úʹÓÃÃüÁîÊÇ£ºmount umount mountall umountall
2¡¢2 nfs·þÎñÆ÷ÉèÖÃ
nfs ·þÎñÆ÷ÐèÒªÔËÐÐÁ½¸öÊغî½ø³ÌmountdºÍnfsdÀ´¹¤×÷¡£µ±nfs¿Í»§»úÊÔͼ·ÃÎÊÒ»¸öÔ¶³ÌµÄnfs·þÎñÆ÷×ÊÔ´¡£nfs¿Í»§»úͨ¹ýmountÃüÁîÇëÇóÓë nfs·þÎñÆ÷µÄmountdÊغî½ø³Ì½øÐÐÁ¬½Ó¡£µ±nfs·þÎñÆ÷ÏìÓ¦¿Í»§»úʱºò£¬·µ»Ø¸ø¿É»§»úÒ»¸öÐÅÏ¢¡£¿Í»§»ú°ÑÕâ¸öÐÅϢдµ½±¾µØµÄ/etc/mnttab ÎļþÖС£Õâ¸öÐÅÏ¢ÊÇ·þÎñÆ÷Öй²ÏíÎļþºÍĿ¼µÄÐÅÏ¢¡£ËüÊÇ×ÊÔ´ÐÅÏ¢µÄ±àÂ룺´ÅÅÌÉ豸ºÅ¡¢½ÚµãÉú³ÉºÅ¡¢½ÚµãºÅµÈ¡£Õâ¸öÊÇΨһµÄ¡£
Ò»µ©¿É»§»úµÃµ½ÇëÇóÐÅÏ¢£¬nfs·þÎñÆ÷ÉϵÄmountd½ø³Ì¾Í»áÔÚ·þÎñÆ÷±¾µØµÄ/etc/rmtabÎļþÖÐÌí¼ÓÒ»ÌõÐÅÏ¢¡£ÕâÊÇΪÁ˱£³Ö¶Ôµ±Ç°¼ÓÔØ¿É»§»úÉÏÎļþµÄ¸ú×Ù¡£Õâ¸öÎļþΪÿһ¸ö±»¼ÓÔØ×ÊÔ´Ìí¼ÓÒ»¸öÌõÄ¿£¬¸ñʽÊÇ£º
remote hostname: local filename name
×¢Ò⣺mountdÿһ´ÎÖØÐÂÆô¶¯ºÍ¿É»§»ú·¢Ò»¸öжÔØÇëÇ󣬶¼»á¸üзþÎñÆ÷µÄ/etc/rmtabÎļþÖеľÉÌõÄ¿¡£
2¡¢3 ¹²ÏíÉèÖÃÃüÁî¡£
Ã÷°×ÁËÒÔÉϵĵÀÀí£¬ÏÂÃæ˵¾ßÌåµÄ²Ù×÷ÁË¡£nfs·þÎñÆ÷ʹÓÃ/usr/sbin/shareÃüÁîΪ¿Í»§»ú¹²Ïí×ÊÔ´¡£
ÃüÁîÏê½â£º
# share ---ÏÔʾËùÓпÉÒÔ°²×°µÄ×ÊÔ´£¬²»¹ÜËüÊÇ·ñÒѾ±»°²×°¡£
# share [ -F filesystem ] [ -o options ] [-d description ] pathname-to-resource
---Ö¸¶¨¹²ÏíÎļþ¡£
* -F file system type Ö¸¶¨±»¹«ÏíµÄÎļþϵͳÀàÐÍ¡£
* -o options Ö¸¶¨¿Í»§¶Ô×ÊÔ´·ÃÎʵÄÀàÐÍ¡£
* -d description ¹¦Ïí×ÊÔ´µÄ¼òµ¥ÃèÊö¡£µ±ÄãshareÃüÁî²»´øÈκβÎÊýÔËÐУ¬Ëû¾Í»á±»ÏÔʾ¡£
* pathname-to-resource ÔÚ·þÎñÆ÷ÉϹ²ÏíµÄ×ÊÔ´Ãû×Ö¡£
------------------------------------------------------
*-o Ö¸¶¨ÁËÔÊÐí¿Í»§·ÃÎʹ²Ïí×ÊÔ´µÄÓû§Ò²È¨ÏÞ¡£¾ßÌåÈçÏ£º
rw ±íʾÓû§¿É¶Á/д£¬ÊÇĬÈÏÖ²¡£
rw=client1£ºclient2 Ö¸¶¨Óû§¿ÉÒÔÓжÁ/дȨÏÞ¡£¿ÉÒÔÓкܶàÓû§£¬ÓÃðºÅ·Ö¸ô¡£
ro ±íʾֻ¶Á¡£
ro=client1£ºclient2 Ö¸¶¨Óû§client1ºÍclient2Ö»¶Á¡£client1¿ÉÒÔÊÇÓû§Ãû£¬Ò²¿ÉÒÔÊÇipµØÖ·£¬»òÕßÒ»¸öÍø¶Î¡£ÀýÈ磺ro=@202.99.88.0/24
root=client£ºclient2 Ö¸¶¨client1ºÍclient2ÉϵÄrootÓû§¶Ô¹²Ïí×ÊÔ´Óг¬¼¶Óû§µÄȨÏÞ¡£µ«ÊÇ£¬ËûµÄÓÅÏȼ¶Ð¡ÓÚnfs·þÎñÆ÷µÄ±¾µØȨÏÞ¡£
ÀýÈ磺Óû§pengÓиöĿ¼/exprot/home/gamesÒª¹²Ïí¡£
# share -F nfs -o rw=lnx3000:race , ro=@202.88.99.0/24:sune450 ,root=mmmmn -d "i love MM !" /export/home/peng/games
ÔËÐнá¹û£º¹²Ïí/exprot/home/peng/gamesĿ¼£¬Ãû×ÖÊÇlnx3000ºÍraceµÄÁ½Ì¨Ö÷»úÓжÁ/дȨÏÞ£»202.88.99.0Õâ¸ö cÀàÍøµÄ»úÆ÷ºÍsun450Õâ¸öÖ÷»úÖ»ÓжÁµÄȨÏÞ£»mmmmnÕą̂Ö÷»úµÄrootÓû§¿ÉÒÔ¶Ô¹²Ïí×ÊÔ´Óг¬¼¶Óû§·ÃÎÊȨÏÞ¡£µ«ÊÇÉùÃûÒ»µã£¬ÒªÊÇÎÒ¸ø¹²ÏíĿ¼ /exprot/home/peng/gamesĿ¼ֻ¶Á£¬mmmmnµÄrootȨÏÞҲûÓÐÓã¬Ö»ÄÜÖ»¶Á¡£ÒòΪ·þÎñÆ÷±¾µØȨÏÞ´óÓÚÈκÎshareµÄȨÏÞ¡£¡£
È¡Ïûshare×ÊÔ´¡£
# unshare [ -F nfs ] path-to-resource
* -F nfs Ö¸¶¨ÏµÍ³ÀàÐÍ£¬Ä¬ÈÏ¡£
* path-to-resource Ö¸¶¨¹²Ïí·¾¶¡£
ÀýÈ磺
# unshare /export/home/peng/games
È¡ÏûÕâ¸ö¹²Ïí×ÊÔ´ÁË¡£
2¡¢4 ¿ª»ú×Ô¶¯¹²Ïí×ÊÔ´¡£
ÒÔÉϵÄÃüÁî·½·¨£¬ÔÚ»úÆ÷ÖØÐÂÆô¶¯µÄʱºò£¬ÉèÖÃÏûʧ¡£ÈçºÎ±£ÁôºÍ¿ª»ú×Ô¶¯Æô¶¯nfs¹²Ïí¡£ÎÒÃÇ¿ÉÒÔÓÃ/etc/dfs/dfstabÎļþÀ´ÊµÏÖ×Ô¶¯¹²ÏíÎļþ¡£Ö»ÒªÖ÷»úÆô¶¯½øÈëÔËÐ춱ð3£¬nfs×ÊÔ´¹²Ïí×Ô¶¯Æô¶¯¡£
1¡¢±à¼/etc/dfs/dfstabÎļþ£¬Ìí¼Ó£º
share [ -F filesystem ] [ -o options ] [-d description ] pathname-to-resource
-----Õâ¸öºÍÃüÁîÐÐÊÇÒ»ÑùµÄ¡£¡£¡£
ÕâÑù¾ÍokÁË¡£
3¡¢ÊÖ¹¤¿ìËÙÃüÁî¡£
# shareall --¹²ÏíËùÓÐÁÐÔÚ/etc/dfs/dfstabÖеĹ²Ïí×ÊÔ´¡£
# unshareall --È¡ÏûËùÓÐÁÐÔÚ/etc/dfs/dfstabÖеĹ²Ïí×ÊÔ´¡£
2¡¢5 ×ÊÔ´²é¿´¡£
# dfshares
ÓÃÒԲ鿴·þÎñÆ÷µÄ¹²Ïí×ÊÔ´ ¡£ÊäÈë¸ñʽÈçÏ£º
resource server access transprot
* resource ¿É±»Ô¶³Ìµ÷ÓõÄ×ÊÔ´µÄÖ÷»úºÍ·¾¶Ãû¡£
* server Ö¸¶¨×ÊÔ´µÄϵͳÃû³Æ¡£
* access ·þÎñÆ÷Ö¸¶¨µÄȨÏÞ£¬Ä¬ÈÏÊÇrw£¬ÏÔʾΪ¡°-¡±¡£
* transport Ö¸¶¨¹²Ïí×ÊÔ´µÄ¶Ë¿Ú¡£
# dfmountsÃüÁî
ÏÔʾ·þÎñÆ÷Éϲ鿴¹²Ïí×ÊÔ´±»ÀûÓõÄ×´¿ö£¬Êä³ö¸ñʽÈçÏ£º
RESOURCE SERVER PATHNAME CLIENTS
* resource ¹²Ïí×ÊÁÏÃû³Æ¡£
* server pathname ¹²Ïí×ÊÁÏĿ¼¡£
* client Á¬½ÓµÄ¿Í»§¶Ë¡£
# nfsstat
¿´nfsµÄÈ«²¿×´Ì¬
3¡¢nfs¿Í»§»úÉèÖá£
°²×°ºÃnfs·þÎñÆ÷ºó£¬¾Í¿ÉÒÔÓÿͻ§¶ËʹÓù²Ïí×ÊÁÏÁË¡£Ê×ÏÈÒª¼ì²ânfs·þÎñÆ÷£¬È»ºó°²×°¡£
3¡¢1 ¼ì²ânfs·þÎñÆ÷¡£
# showmount [ -ade ]
* -a ÏÔʾÒѾÒѾʹÓõÄ×ÊÔ´ºÍÀ´×ÔÄĸönfs·þÎñÆ÷¡£
* -d ÏÔʾÒѾ±»Ô¶³Ì°²×°µÄ×ÊÔ´¡£
* -e ÏÔʾ¿ÉÒÔ±»°²×°µÄ¿ÉÒÔ×ÊÔ´¡£Ò»°ãÓÃ-eÀ´²é¿´Ô¶³ÌÖ÷»úµÄ¿ÉÒÔ×ÊÔ´¡£
3¡¢2 ½¨Á¢¹²Ïí¡£
# mount [ -F nfs ] [ -o options ] path-to-resource path-to-local-mount-point
* -F nfs Ö¸¶¨¹²ÏíÎļþϵͳ£¬Ä¬Èϵġ£Ã»±ØÒªÖ¸¶¨¡£
* -o options Ö¸¶¨Ñ¡ÏÀýÈçȨÏÞ¡£Ä¬ÈÏrw£¬¿É¶Á/д¡£Ò²¿ÉÒÔro--Ö»¶Á¡£
* path-to-rescource Ö¸¶¨nfs·þÎñÆ÷µÄÖ÷»úÃûºÍ¹²Ïí×ÊԴ·¾¶¡£
* path-to-local-mount-point Ö¸¶¨¹²Ïí×ÊÔ´ÔÚ±¾µØµÄmountµã¡£
ÀýÈ磺
# mkdir /export/home/games
# mount peng:/export/home/peng/games /exprot/home/games
¹²ÏíÔ¶³ÌÖ÷»úpengµÄ/export/home/peng/gamesĿ¼£¬¿É¶Áд£¬¹Ò½ÓÔÚ±¾µØµÄ/exprot/home/gamesĿ¼ÉÏ¡£
3¡¢3È¡Ïû¹²Ïí¡£
# umount [-F nfs] remote-path-to-resource path-to-local-mount-point
* -F nfs ĬÈϵÄÎļþϵͳ¡£
* remote-path-to-resource Ô¶³ÌÖ÷»úºÍ¹²ÏíĿ¼·¾¶£¬Ö÷»úºÍ¹²ÏíĿ¼·¾¶ÓÃðºÅ·Ö¸ô¡£
* path-to-local-mount-point ±¾µØÖ÷»ú¹Òµã¡£
ÀýÈ磺
# umount peng:/export/home/peng/games /export/home/games
È¡ÏûÔ¶³ÌÖ÷»úpengÉϵÄ/exprot/home/peng/gamesÕâ¸öĿ¼µÄÔÚ±¾µØ/export/home/gamesÉϵĹ²Ïí¡£
3¡¢4 ϵͳ¿ª»ú×Ô¶¯¹²Ïí¡£
ÐÞ¸Ä/etc/vfstabÎļþ£¬¸ñʽÈçÏ£º
device to mount device to fsck mount point FS type fsck pass mount at boot mount options
* device to mount Ö¸¶¨Ô¶³Ì·þÎñÆ÷ÃûºÍ¹²Ïí·¾¶¡£Ô¶³Ì·þÎñÆ÷ÃûºÍ¹²Ïí·¾¶ÓÃðºÅ·Ö¿ª¡£
* device to fsck Õâ¸öÊǿյġ£´ÓÀ´²»´Ó¿Í»§»ú½øÐÐÎļþ¼ì²â¡£
* mount point Ö¸¶¨±¾µØµÄmountµã¡£Õâ¸öĿ¼±ØÐëÊÇÒѾ´æÔڵġ£
* FS type ¶ÔÓÚnfs×ÊԴϵͳÀ´Ëµ£¬µ±È»ÊÇnfsÁË¡£
* fsck pass Õâ¸öÒ²Êǿյġ£±íʾ²»´Ó¿Í»§»ú½øÐÐÎļþϵͳ¼ì²â¡£
* mount at boot Ñ¡Ôñyes or no£¬yes¾ÍÊÇÆô¶¯Ê±×Ô¶¯°²×°¡£
* mount options ÓöººÅ·Ö¸ôµÄmountÃüÁîµÄÁÐ±í¡£
ÀýÈ磺
# vi /etc/vfstab Ìí¼Ó£º
peng:/export/home/peng/games - /export/home/games nfs - yes soft,bg
±íʾ¿ª»ú×Ô¶¯°ÑÔ¶³ÌÖ÷»úpengµÄ/export/home/peng/gamesĿ¼×Ô¶¯¹Òµ½±¾»úµÄ/export/home/gamesÏ¡£softÑ¡ÏîÊÇĿ¼²»ÄÜ°²×°£¬²úÉúÒ»¸ö´íÎó¡£bgÑ¡ÏϵͳÆô¶¯¹ý³ÌÖа²×°ÔÚºǫ́¡£
¹ØÓÚmount optionsµÄ²ÎÊý£¬ÇëÓà man mount ×Ô¼º¿´¿´°É¡£
3¡¢5 ÊÖ¹¤µ÷ÊÔÃüÁî¡£
# mountall
²»´øÈκβÎÊý£¬°²×°ËùÓÐÁÐÔÚ/etc/vfstabÎļþÖÐmount at bootÖÐΪyesµÄ×ÊÔ´¡£
# mountall -r Ö»Ó°ÏìÔ¶³ÌÎļþ
# mountall -l Ö»Ó°Ïì±¾µØÎļþ
# umountall
²»´øÈκβÎÊý£¬Ð»ÔØÒѾ°²×°µÄ×ÊÔ´¡£²»°üÀ¨/ ¡¢/proc¡¢/usr¡¢/var¡£ÁíÍ⣬ϵͳ棬Ҳ¿ÉÄܲ»»áжÔØ¡£
# umountall -r Ö»Ó°ÏìÔ¶³ÌÎļþ
# umountall -l Ö»Ó°Ïì±¾µØÎļþ
С½Ú£º
µ½ÕâÀïÎÒÏëÓ¦¸ÃûÓÐʲôÎÊÌâÁË¡£
´ó¼ÒֻҪעÒâһϿͻ§¶ËºÍ·þÎñÆ÷¶ËµÄÇø·Ö¡£
nfs·þÎñÆ÷¶ËÔËÐÐÊغî½ø³Ìmound¡¢nfsd
nfs·þÎñÆ÷¶ËʹÓÃÎļþ/etc/dfs/dfstab¡¢/etc/dfs/sharetab¡¢/etc/rmtab
nfs·þÎñÆ÷ʹÓÃÃüÁîÊÇ£ºshare unshare shareall unshareall
nfs¿Í»§¶ËÔËÐÐÊغî½ø³Ìstatd¡¢lockd¡£
Óõ½µÄÎļþÊÇ/etc/vfstab¡¢/etc/mnttab
nfs¿Í»§»úʹÓÃÃüÁîÊÇ£ºmount umount mountall umountall
ÖªµÀÕâЩ£¬¾ÍokÁË¡£
FAQ :
1¡¢ÔËÐÐmountÃüÁî²»Äܵõ½¹²Ïí×ÊÔ´£¬µÃµ½ÐÅÏ¢£º¡°nfs server not responding¡±¡£
answer£ºÈ·ÐÅ·þÎñÆ÷ÉÏnfsdºÍmountdÒѾÔËÐУ¬×ÊÔ´ÒѾÓù²ÏíÃüÁîÕýÈ·¹²Ïí¡£
2¡¢µ±ÎÒÆóͼ¹²Ïíµ½±¾µØ´ÅÅÌʱ£¬´íÎóΪ£º¡°mount£º/tmp_mount not found¡±.
answer: ÄãÓÐûÓÐÔÚ±¾µØ´´½¨mountµã¡£