الفلاتر
طريقة البحث
  • الكلمات العادية تجد الأسماء والنصوص والأمثلة.
  • "كلمتان" تجد العبارة بالضبط.
  • --name أو -x تجد خيارًا.
  • #كلمة تبحث داخل الأوامر فقط.
  • @grep تجد الدروس والمعامل التي تستخدم grep.
  • الفلاتر: cat:network · in:labs · level:rhcsa · ch:8 · root:yes. ضع ! قبل كلمة لاستبعادها. OR بين الكلمات تعني إحداها.
  • ↑ ↓ للتنقل · Enter للفتح · Esc للإغلاق · / للبحث

automount

The autofs daemon: mounts file systems (mostly NFS) when they are used and unmounts them when idle. Managed with systemctl; the command helps debugging.

المستوى
امتحان RHCSA
المجموعة
الأقراص وأنظمة الملفات
يحتاج root
نعم
الحزمة
autofs

هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.

ماذا يفعل

autofs runs as autofs.service. The master map (/etc/auto.master and /etc/auto.master.d/*.autofs) lists base folders and map files; map files list keys, options and sources. * and & make one line work for many folders (home folders). After changing maps, restart or reload autofs. automount -m prints all maps as autofs sees them.

طريقة الكتابة

automount [OPTION]... [MASTER_MAP]

الأجزاء الرئيسية

/base /etc/auto.NAME
Master map line: indirect mounts under /base.
/- /etc/auto.direct
Master map line: direct mounts (full paths in the map).
key -options server:/path
Map line (indirect).
/full/path -options server:/path
Map line (direct).
* -rw server:/home/&
Wildcard: & is the key that was asked for.
--timeout=N
In the master map: unmount after N idle seconds.

الخيارات 18

الأكثر استخدامًا

-m, --dumpmaps [TYPE NAME]
Print the maps and exit.
-f, --foreground
Run in the foreground (debug).
-d[LEVEL], --debug[=LEVEL]
Debug output.
-v, --verbose
Verbose log.
-t, --timeout SECONDS
Default idle timeout (600).
-n, --negative-timeout SECONDS
Cache time for failed lookups.
-M, --master-wait SECONDS
Wait for the master map at start.
-D VARIABLE=VALUE, --define VARIABLE=VALUE
Define a map variable.
-p, --pid-file FILE
PID file.
-r, --random-multimount-selection
Random server choice for replicated mounts.
-O, --global-options OPTIONS
Options added to all mounts.
-l, --set-log-priority PRIORITY PATH
Change the log level of a running daemon for a path.
-S, --systemd-service
Run as a systemd service.
-C, --dont-check-daemon
Do not check for a running daemon.
-F, --force
Force unlink of old mount points at start.
-U, --force-exit
Force exit, unmount everything.
-h, --help
Show help.
-V, --version
Show the version.

أمثلة 10

$ مستخدم عادي# بصلاحية root (أو مع sudo)

  1. 1Install and start

    dnf install -y autofs
    systemctl enable --now autofs

    Reads the master map.

  2. 2Indirect map

    cat /etc/auto.master.d/shares.autofs /etc/auto.shares
    /shares /etc/auto.shares
    data -rw server2:/exports/data

    /shares/data mounts on first use.

  3. 3Home folders with a wildcard

    cat /etc/auto.rhome
    * -rw server2:/exports/home/&

    /rhome/lisa → server2:/exports/home/lisa.

  4. 4Apply map changes

    systemctl restart autofs

    Or systemctl reload autofs for map file changes.

  5. 5Show what autofs knows

    automount -m

    All maps after parsing.

  6. 6Trigger and check a mount

    ls /shares/data; findmnt /shares/data

    The folder appears only when used.

  7. 7Debug a failing map

    systemctl stop autofs; automount -f -d

    Foreground with debug output; then ls /shares/data in another terminal.

  8. 8Unmount after 60 seconds

    echo "/shares /etc/auto.shares --timeout=60" > /etc/auto.master.d/shares.autofs

    Shorter idle time.

  9. 9Direct map

    cat /etc/auto.direct
    /srv/projects -rw,soft server2:/exports/data

    Master map line: /- /etc/auto.direct.

  10. 10Logs

    journalctl -u autofs --since -10min

    Errors like "mount(nfs): nfs: mount failure".

الملفات

/etc/auto.master, /etc/auto.master.d/*.autofs
Master map.
/etc/auto.*
Map files.
/etc/autofs.conf
Daemon settings.

رموز الخروج

0Done.
1Error.

الدليل الكامل

هذه الصفحة تشرح الأمر بكلمات بسيطة. الدليل الأصلي فيه كل التفاصيل.

في الطرفية: man 8 automount