nfs単純構築

2737 ワード

詳細

NFS(Network File System)      ,    ,   NFS                ,        ,             。     Linux      

      
1,    (192.168.0.100)     (192.168.0.10)          nfs,        ,      

rpm -qa | grep nfs
rpm -qa | grep rpcbind
       ,        
yum install nfs-utils					-- ContOS

      ,         。         , nfs 

/etc/exports                           NFS         ,      
/usr/sbin/exportfs                   NFS       
/usr/sbin/showmount                      
/var/lib/nfs/etab                        NFS               
/var/lib/nfs/xtab                                   

   /etc/exports    ,                    。              ,            ,     vi /etc/exports        ,    :wq  

           IP   (  )

 
/mnt/uploadfiles 192.168.0.10(rw,async,anonuid=0,anongid=0)

      /mnt/uploadfiles       192.168.0.10            (       ,   )          (               ,        ),anonuid anongid          id

()       :
ro:      ;
rw:        ;
all_squash:                  ;
no_all_squash(  ):            ,                 ;
root_squash(  ):    root             ;
no_root_squash:   root    root    ;
anonuid=:             UID,   nfsnobody(65534);
anongid=:              GID,   nfsnobody(65534);
secure(  ):          1024 tcp/ip       ;
insecure:        1024 tcp/ip       ;
sync:                ,   ,           ;
async:             ,        ;
wdelay(  ):           ,              ,        ;
no_wdelay:          ,  sync    ;
subtree_check(  ) :           , nfs             ;
no_subtree_check :            ,nfs              ,        ;

        nfs  ,  nfs      rpcbind       ,     nfs ,    rpcbind         nfs  

      
/etc/init.d/rpcbind start
/etc/init.d/nfs start
   ,    
showmount -e localhost

         /etc/exports        ,           
exportfs -arv    rpc  ,              exportfs -auv

   /mnt/uploadfiles           
chmod 777 -R /mnt/uploadfiles

  ,           


     
1,          ,  ,  ,         /etc/exports    。
2,           ,           , 
mkdir -p /mnt/nfs
3,    
mount -t nfs NFS   IP:/              
 
mount -t nfs 192.168.0.100:/mnt/uploadfiles /mnt/nfs

    
umount /mnt/nfs
   device or resource busy(      ),  
lsof | grep /mnt/nfs
  pid ,  kill -9  

  ,        /mnt/nfs            。           , /mnt/nfs           /mnt/uploadfiles ,  /mnt/uploadfiles           ,