How to nfs share zfs filesystems in Solaris?



  • You can share filesystems without using /etc/dfs/dfstab by using the sharenfs option. By default, this option is set to off.

    # zfs set sharenfs=on test_pool/fs1
    

    Check:

    # zfs get sharenfs test_pool/fs1
    NAME           PROPERTY  VALUE          SOURCE
    test_pool/fs1  sharenfs  on             local
    

    This property is inherited so if a filesystem is shared, all children filesystems created after sharenfs is set to "on" will also be shared.

    # zfs create test_pool/fs1/data
    
    # zfs get sharenfs test_pool/fs1/data
    NAME                PROPERTY  VALUE               SOURCE
    test_pool/fs1/data  sharenfs  on                  inherited from test_pool/fs1
    

    By default, this shares with read/write access for everyone.

    To share with read-only access:

    # zfs set sharenfs=ro test_pool/fs1
    

    Check:

    # zfs get sharenfs test_pool/fs1
    NAME           PROPERTY  VALUE          SOURCE
    test_pool/fs1  sharenfs  ro             local
    


© Lightnetics 2024