Filters
Zo zoek je
  • Gewone woorden vinden namen, teksten en voorbeelden.
  • "twee woorden" vindt precies die zin.
  • --naam of -x vindt een optie.
  • #woord zoekt alleen in commando's.
  • @grep vindt lessen en labs die grep gebruiken.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Zet ! voor een woord om het weg te laten. OR tussen woorden betekent één ervan.
  • ↑ ↓ bewegen · Enter openen · Esc sluiten · / zoeken

exportfs

Manage the NFS export table: apply changes of /etc/exports, show the active exports, or export a folder for a moment.

Niveau
RHCSA-examen
Groep
Schijven en bestandssystemen
Root nodig
Ja
Pakket
nfs-utils

Dit deel is nog niet vertaald. Je ziet de Engelse tekst.

Wat het doet

The NFS server reads /etc/exports and /etc/exports.d/*.exports when it starts. After editing, run exportfs -ra to apply the changes without a restart. exportfs -v shows what is exported now, with all options.

Zo schrijf je het

exportfs [-avfrsu] [-o OPTIONS] [CLIENT:/PATH]
exportfs -ra | -ua | -v | -s

Opties 9

Meest gebruikt

-r
Re-export all: sync with /etc/exports (removes deleted entries).
-a
Export (or with -u unexport) all folders.
-u
Unexport one or more folders (-ua = all).
-v
Verbose; with no other option: show the exports with options.
-s
Show the exports in /etc/exports format.
-o OPTIONS
Options for a folder given on the command line.
-i
Ignore /etc/exports; only use the command line.
-f
Flush the kernel export table.
-d, --debug KIND
Debug output (all, auth, call, general, parse).

Voorbeelden 10

$ als gewone gebruiker# als root (of met sudo)

  1. 1Apply changes of /etc/exports

    exportfs -ra

    No restart of nfs-server needed.

  2. 2Show active exports

    exportfs -v
    /exports/data  192.168.122.0/24(sync,wdelay,hide,no_subtree_check,sec=sys,rw,secure,root_squash,no_all_squash)

    All options, also the defaults.

  3. 3Example exports file

    cat /etc/exports
    /exports/data  192.168.122.0/24(rw,sync)
    /exports/home  192.168.122.0/24(rw,sync)

    Folder, then client(options) — no space before the bracket!

  4. 4Export for a moment (not saved)

    exportfs -o ro,sync 192.168.122.20:/srv/iso

    Gone after a restart.

  5. 5Stop exporting one folder

    exportfs -u 192.168.122.0/24:/exports/data

    Clients lose access.

  6. 6Stop all exports

    exportfs -ua

    For maintenance.

  7. 7Files in exports.d

    echo "/srv/iso *(ro)" > /etc/exports.d/iso.exports; exportfs -ra

    One file per share is easy to manage.

  8. 8The space mistake

    cat /etc/exports
    /exports/data 192.168.122.0/24 (rw)

    With a space, (rw) applies to everyone and the network gets read-only: a security hole.

  9. 9Read-only for all, write for one host

    echo "/exports/pub *(ro) 192.168.122.20(rw)" >> /etc/exports; exportfs -ra

    Different options per client.

  10. 10Check the server service

    systemctl status nfs-server

    exportfs works only with the server running.

Bestanden

/etc/exports, /etc/exports.d/*.exports
Export definitions.
/var/lib/nfs/etab
The active export table.

Exitcodes

0Done.
1Error.