Netapp 存储文件共享-Linux 主机应用

    技术2022-07-11  106

    Linux /UNIX 访问存储是通过NFS 协议,进行读写数据的!

    创建一个Linux卷

    fas8020-1>

    fas8020-1>

    fas8020-1>

    fas8020-1> vol create linux aggr0 100m

    Creation of volume 'linux' with size 100m on containing aggregate

    'aggr0' has completed.

    fas8020-1>

    fas8020-1>

    fas8020-1>

    配置linux 卷共享访问

    默认linux 卷的权限是放开的,就是所有主机都可以mount

     

    /vol/linux      -sec=sys,rw,nosuid

     

     

    主机挂载

    [root@localhost /]#

    [root@localhost /]# mkdir nfs

    [root@localhost /]#

    [root@localhost /]# mount 100.100.100.39:/vol/linux /nfs

    [root@localhost /]#

    设置所有的主机都有读写权限

    fas8020-1>

    fas8020-1> exportfs -p rw,anon=0,sec=sys /vol/linux

    fas8020-1> rdfile /etc/exports

    #Auto-generated by setup Wed Jul  1 07:42:44 GMT 2020

    /vol/vol0       -sec=sys,rw,anon=0,nosuid

    /vol/vol0/home  -sec=sys,rw,nosuid

    /vol/windows    -sec=sys,rw,nosuid

    #/vol/linux     -sec=sys,rw,nosuid

    /vol/linux      -sec=sys,rw,anon=0

    fas8020-1>

    主机1读写测试

    100.100.100.38 Linux主机

     

     

    [root@localhost nfs]# cat >test_file01.txt

    this is test file on 100.100.100.38!

    ^C

    [root@localhost nfs]#

    [root@localhost nfs]# ls

    test_file01.txt

    [root@localhost nfs]# cat test_file01.txt

    this is test file on 100.100.100.38!

    [root@localhost nfs]#

     

    主机2读写测试

    100.100.100.4

     

    [root@ /]#

    [root@ /]# mount 1100.100.100.39:/vol/linux /nfs

    [root@ /]#

     

    [root@ /]# df -Th

    Filesystem              Type      Size  Used Avail Use% Mounted on

    devtmpfs                devtmpfs  7.9G     0  7.9G   0% /dev

    tmpfs                   tmpfs     7.9G     0  7.9G   0% /dev/shm

    tmpfs                   tmpfs     7.9G   65M  7.8G   1% /run

    tmpfs                   tmpfs     7.9G     0  7.9G   0% /sys/fs/cgroup

    /dev/mapper/centos-root xfs        49G  3.1G   46G   7% /

    /dev/sda1               xfs      1014M  258M  757M  26% /boot

    tmpfs                   tmpfs     1.6G     0  1.6G   0% /run/user/0

    100.100.100.39:/vol/linux  nfs        80M  256K   80M   1% /nfs

    [root@ /]#

     

    [root@wch nfs]#

    [root@wch nfs]# cat >test_file02.txt

    this is test file on 1100.100.100.4!!!

    ^C

    [root@wch nfs]#

    [root@wch nfs]# ls

    test_file01.txt  test_file02.txt

    [root@wch nfs]# cat test_file01.txt

    this is test file on 100.100.100.38!

    [root@wch nfs]# cat test_file02.txt

    this is test file on 1100.100.100.4!!!

    [root@wch nfs]#

    设置特定的主机

    读写权限

    fas8020-1>

    fas8020-1> exportfs -p rw=100.100.100.38,anon=0,sec=sys /vol/linux

    fas8020-1>

     

    只有100.100.100.38有权限

    其他主机则不能读写!

     

     

    [root@~]#

    [root@ ~]# mount 100.100.100.39:/vol/linux /nfs

    mount.nfs: access denied by server while mounting (null)

    [root@ ~]# mount 100.100.100.39:/vol/linux /tmp

    mount.nfs: access denied by server while mounting 10.83.35.39:/vol/linux

    [root@ ~]#

    [root@ ~]#

     

    ########################################################################

     

    [root@localhost nfs]# ls

    test_file01.txt  test_file02.txt

    [root@localhost nfs]#

    [root@localhost nfs]#

    [root@localhost nfs]# cat >test_file03.txt

    this is test_file03 on 100.100.100.38!!!

    ^C

    [root@localhost nfs]# ls

    test_file01.txt  test_file02.txt  test_file03.txt

    [root@localhost nfs]#

     

     

     

    Processed: 0.012, SQL: 9