[NFS][SMB]有关mount的小总结

最近一直在做macos上的mount测试,涉及nfs和smb,也需要对比windows的行为,做个小小总结

pre-1. #### 首先要在server/cluster上 分别设置2个share point,nfs 和 smb

mkdir mpssmb
chmod -Rf 777 mpssmb
isi smb shares create --name mpssmb --path /ifs/data/mpssmb --auto-create-directory 1 --oplocks 0
isi smb shares permission modify mpssmb --wellknown Everyone --permission-type allow --permission full

isi nfs settings global view
mkdir -p /ifs/data/testmps
chmod 0777 /ifs/data/testmps
isi nfs exports create /ifs/data/testmps --all-dirs=yes --map-root=root
  1. mount nfs on macos

    1.1 mount nfsv3 on macos

    mount -t nfs -o vers=3 10.224.38.244:/ifs/data/testmps  /var/root/loadmaster0_node1
    

    此时,无法使用acl的内容,当尝试用chmod +a 'admin allow write' aaa 添加ace时,会报错chmod: Failed to set ACL on file 'aaa': Operation not supported

    1.2 mount nfsv4 on macos

    mount -t nfs -o vers=4 10.224.38.244:/ifs/data/testmps  /var/root/loadmaster0_node1
    

    此时,发现chmod +a依然无效,并且cluster上添加了acl的file/folder,在macos上展示不出来,用nfsstat -m 查看mount的具体信息:

    /Users/username/mountpoint from 10.224.38.244:/ifs/data/testmps
        Original mount options:
         General mount flags: 0x0
         NFS parameters: vers=4
         File system locations:
           /ifs/data/testmps @ 10.224.38.244 (10.224.38.244)
      -- Current mount parameters:
         General mount flags: 0x4000000 multilabel
         NFS parameters:                   vers=4.0,tcp,port=2049,hard,nointr,noresvport,callback,negnamecache,nonamedattr,noacl,noaclonly,locks,noquota,rsize=32768,wsize=32768,readahead=16,dsize=32768,nordirplus,nodumbtimr,timeo=10,maxgroups=16,acregmin=5,acregmax=60,acdirmin=5,acdirmax=60,nomutejukebox,noephemeral,nonfc,sec=sys
         File system locations:
           /ifs/data/testmps @ 10.224.38.244 (10.224.38.244)
         Status flags: 0x0
    

    可以看到NFS parameters中,有个参数noacl,需要把它改成acl:

    mount -t nfs -o vers=4,acl 10.224.38.244:/ifs/data/testmps  /var/root/loadmaster0_node1
    

    然后可以通过chmod +a 来给file/folder增加ace, server cluster上和macos client上增加ace的方式不一样:
    假如我们有个用户名:owner1,那么赋予ta 读的权限,操作如下:
    on cluster:
    chmod +a user owner1 allow "dir_gen_read" aaa
    on client:
    chmod +a "owner1:allow:read" file

  2. mount smb on macos client

    mount -t smbfs //owner1@daaa.com/ifs/home/username/devcode /var/root/devcode

  3. mount smb on windows client with domain name

    比如:remote server: aaa.com, mount 路径是/ifs/home/devcode, domain:deskdomain, 用户名:owner1

    net use U: \\aaa.com\ifs\data\mpssmb /user:deskdomain\owner1


新需求,要在osx上 对同一个smb share point mount多次,

  1. mount -t smbfs username:pwd@ip/sharename /LocalPath 只能mount一次
    //[domain;][user[:password]@] server[/share]

  2. script editor 也只能mount一次

但是 它俩加起来 也算是实现了对同一个 share point mount了两次
如何 超越2次呢?

update:

mount_smbfs -s //root:123@192.168.39.192/test01 /var/root/testmount

//root@192.168.39.192/test01 on /private/var/root/testmount (smbfs)
//root@192.168.39.192/test01 on /private/var/root/testmount01 (smbfs)
//root@192.168.39.192/test01 on /private/var/root/testmount02 (smbfs)

mount -t smbfs //root@192.168.39.194/test01 /var/root/testmount04

//root@192.168.39.194/test01 on /Volumes/mpstest01-1 (smbfs, nodev, nosuid, mounted by protocols)
//root@192.168.39.192/test01 on /Volumes/mpstest01-2 (smbfs, nodev, nosuid, quarantine, mounted by protocols)
//root@192.168.39.192/test01 on /private/var/root/testmount (smbfs)
//root@192.168.39.192/test01 on /private/var/root/testmount01 (smbfs)
//root@192.168.39.193/test01 on /private/var/root/testmount03 (smbfs)
//root@192.168.39.194/test01 on /private/var/root/testmount04 (smbfs)

这两种方式mount 的结果都一样,不过用mount_smbfs -s 可以mount多个session

posted @ 2020-04-19 16:02  vivi~  阅读(812)  评论(0编辑  收藏  举报