Dit deel is nog niet vertaald. Je ziet de Engelse tekst.
Wat het doet
mount DEVICE FOLDER makes the file system on DEVICE visible in FOLDER (the mount point). The type is detected automatically. mount -a mounts everything in /etc/fstab that is not mounted yet — the test after editing fstab. Options (-o) control the behaviour: read-only, no programs, no SUID …
Without arguments it lists all mounts; findmnt shows the same in a clearer way.
Zo schrijf je het
mount [OPTION]... DEVICE|UUID=…|LABEL=… DIRECTORY
mount [OPTION]... DEVICE|DIRECTORY
mount -a [-t TYPE] [-O OPTIONS]Belangrijkste delen
defaults- rw, suid, dev, exec, auto, nouser, async.
ro/rw- Read-only / read-write.
noexec- Programs cannot run from this file system.
nosuid- SUID/SGID bits do not work.
nodev- Device files do not work.
noatime/relatime- Do not update / update access times sometimes.
_netdev- Network file system: mount after the network is up.
nofail- Do not fail the boot if the device is missing.
noauto- Not mounted by mount -a or at boot.
user/users- Normal users may mount it.
loop- Mount a file (like an ISO) through a loop device.
remount- Change options of a mounted file system.
bind- Mount a folder in a second place.
context=- SELinux context for the whole file system.
uid=,gid=,umask=- Owner and mode for file systems without Linux rights (vfat).
Opties 29
Meest gebruikt
Niets past bij dit filter.
Voorbeelden 12
$ als gewone gebruiker# als root (of met sudo)
1Mount a partition
mkdir /data; mount /dev/vdb1 /dataThe type is detected.
2Mount by UUID or label
mount UUID="4e5c7a6b-3f1d-4c2e-9a5b-7d2f8e1c0a93" /data mount LABEL=data /dataStable names.
3Test /etc/fstab
systemctl daemon-reload; mount -aNo output = all lines work. Do it before every reboot.
4Mount an ISO file
mount -o loop,ro rhel-10.0-x86_64-dvd.iso /repoUse it as a local repository.
5Read-only
mount -o ro /dev/vdb1 /mntSafe for inspection of a disk.
6Change options without unmount
mount -o remount,ro /dataAlso used in rescue mode:
mount -o remount,rw /.7Harden /tmp-like folders (security)
mount -o remount,noexec,nosuid,nodev /var/tmpAttackers cannot run downloaded programs from there. Put it in fstab to keep it.
8Bind mount a folder
mount --bind /srv/www /var/www/htmlSame files in two places.
9A RAM disk
mount -t tmpfs -o size=512M tmpfs /mnt/ramFast temporary space; gone after unmount.
10NFS share
mount -t nfs server2:/exports/share /mntNetwork file systems are covered in the NFS chapter.
11Create the mount point automatically
mount -m /dev/vdb1 /mnt/newNewer util-linux.
12List mounts of one type
mount -t xfsOr better:
findmnt -t xfs.
Niets past bij dit filter.
Let op
- Mounting on a folder hides its old content until you unmount.
- A mount by hand is gone after reboot; use /etc/fstab or a mount unit.
Bestanden
/etc/fstab- File systems to mount at boot.
/proc/self/mountinfo- The kernel list of mounts.
Exitcodes
0 :: Done. 1 :: Wrong use or permissions. 2 :: System error (out of memory, cannot fork …). 4 :: Internal mount bug. 8 :: User interrupt. 16 :: Problems writing or locking mtab. 32 :: Mount failure. 64 :: Some mounts worked (with -a).