zoukankan      html  css  js  c++  java
  • nfs网络文件系统

    安装

    # apt-get install nfs-kernel-server
    

    配置挂载目录和权限

    # vim /etc/exports
    /home/rootfs *(rw,sync,no_root_squash)
    /home/rootfs 192.168.0.*(rw) *(ro)
    /home/rootfs 192.168.0.0/24(rw) *(ro)
    

    *:所有的IP都可以访问
    ro:只读
    rw:可读写
    sync:同步写入硬盘
    async:暂存内存
    root_squash:root用户访问此目录, 映射成如anonymous用户一样的权限
    no_root_squash: root用户访问此目录,具有root操作权限
    wdelay:多个用户对共享目录进行写操作时,则按组写入数据
    no_wdelay:多个用户对共享目录进行写操作时,则立即写入数据

    重启

    # /etc/init.d/nfs restart  
    

    查看共享状态

    # showmount -e 127.0.0.1
    Export list for 127.0.0.1:
    /home/pi/fs_mini *
    
    # rpcinfo -p 127.0.0.1
    

    出现如下错误:(树莓派)

    # showmount -e 127.0.0.1
    clnt_create: RPC: Port mapper failure - Unable to receive: errno 111 (Connection refused)
    

    解决办法:

    # sudo /etc/init.d/rpcbind start
    # sudo /etc/init.d/nfs-kernel-server restart
    

    挂载测试

    # sudo mount -t nfs -o nolock 127.0.0.1:/home/nfs_server /mnt
    

    操作系统下,也可以挂载nfs来调试

    exports
    修改了/etc/exports后,并不需要重启nfs服务,只要用exportfs重新扫描一次/etc/exports

    -a           递增式更新,对/etc/exports 增加或修改的部分进行挂载和卸载
    -i<文件>      指定配置文件
    -r           更新配置,重新读取/etc/exports 
    -u           卸载指定目录
    -o           使用指定参数
    -v           显示共享详细情况
    
    # exportfs -r  //重新配置
    # exportfs -au //卸载所有共享目录
    

    通过nfs下载内核

    # nfs 32000000 192.168.1.12:/work/nfs_root/uImage
    

    启动内核报错

    VFS: Unable to mount root fs via NFS, trying floppy
    VFS: Cannot open root device "nfs" or unknown-block(2,0): error -6
    Please append a correct "root=" boot option; here are the available partitions
    

    可能原因:

    1. 网卡驱动没有移植好
    2. NFS服务器配置不正确
    3. 没有安装NFS服务
    Kernel panic - not syncing: No init found
    

    NFS文件系统的权限不够

  • 相关阅读:
    hdoj:2075
    hdoj:2072
    hdoj:2071
    hdoj:2070
    hdoj:2069
    test001
    hdoj:2067
    hdoj:2061
    hdoj:2058
    hdoj:2057
  • 原文地址:https://www.cnblogs.com/zhangxuechao/p/11709801.html
Copyright © 2011-2022 走看看