Die Datei /etc/fstab auf Linux Systemen / The File /etc/fstab on Linux Systems (DE / EN)

in #linuxlast year (edited)

Die Datei /etc/fstab auf Linux Systemen

(English Below / Englisch unten)

Um auf einem Linux System bei jedem Systemstart alle gewünschten Dateisysteme zur Verfügung zu haben muss man diese in die /etc/fstab Datei eintragen. Das System geht die in dieser Datei eingetragenen Dateisysteme von Anfang bis Ende durch und hängt sie ein wenn sie nicht mit der Option noauto gekenzeichnet sind.

Jede Zeile in /etc/fstab steht für ein Dateisystem. Jede Zeile besteht aus 6 Feldern. Zeilen die mit einem "#" beginnen sind Kommentare. Auf dem Bild unten ist eine Beispiel fstab mit diversen Kommentaren zu sehen.

045.etc-fstab.jpg

Ein Dateisystem kann entweder mit seinem Gerätenamen (/dev/sda7) oder mit seiner UUID eingetragen werden. Die UUID hat den Vorteil das sie sich nicht ändert wenn z.b eine Festplatte auf einen anderen SATA Port gesteckt wurde oder mehrere USB Sticks an einem Computer eingesteckt sind. Die UUID einer Partition oder eines USB Sticks kann man mit blkid auslesen.

Die erste Zeile ist das root Dateisystem des Systems.
Hier wurde im Beispiel im ersten Feld für das Dateisystem eine UUID eingetragen.Im zweiten Feld wird das Verzeichniss angegeben wo das Dateisystem eingehängt wird. Das dritte Feld enthält Angabe zur Art des Dateisystems, hier kann sowohl ein bestimmter Type (z.b ext4) eingetragen werden, bei Wechselplatten ist aber automatische Erkennung mittels "auto" Option anzuraten. Im vierten Feld können Optionen übergeben werden Das fünfte Feld wird für Datensicherungen mit dem Programm dump benötigt. dump sollte auf Linuxsystemen nicht verwendet werden. Die Spalte ist also nur nötig um Kompatibelität zu wahren.

In Feld 6 wird festgelegt wann und ob die Dateisysteme beim Booten des Systems überprüft werden.
0 - Keine Überprüfung(insbesondere für WEchselmedien)
1 - Werden als erstes Überprüft
2 - Werden danach Überprüft.

Warum in dieser Tabelle auch /dev/sdb und /dev/sdc auftauchen?
Normalerweise werden Dateisysteme immer in Partitionen geschrieben, mir sind genug USB Sticks untergekommen bei denen der Zugriff auf z.b /dev/sdb1 nicht möglich war. Es war aber Problemlos möglich sie über /dev/sdb zu mounten.

Die genaue Anzahl der verfügbaren Optionen in Feld 4 ist abhängig davon welches Dateisystem zum Einsatz kommt. D.h hier nur ein paar Beispiele:
noauto - Dateisystem wird nicht beim Booten eingehängt
nodev - Gerätedateien innerhalb dieses Dateisystems werden ignoriert.
noexec - Vom Dateisystem können eine ausführbaren Dateien gestartet werden. (Achtung: Das gilt z.b auch für Bash Scripte!!)
exec - Vom Dateisystem können ausführbare Dateien gestartet werden. Wird z.b benötigt um Bash Scripte von einem USB Stick zu starten.
rw - Read/Write
ro - Read Only
user - Normale Benutzer dürfen das Dateisystem einhängen. Der Benutzer der das Dateisystem eingehängt hat darf es auch wieder aushängen.
users - Normale Benutzer dürfen das Dateisystem einhängen. Alle Benutzer dürfen es wieder aushängen.


English Version

The File /etc/fstab on Linux Systems (DE / EN)

In order to have all desired file systems available on a Linux system every time the system started, they must be entered in the /etc/fstab file. The system goes through the file systems listed in this file from start to finish and mounts them if they are not marked with the noauto option.

Each line in /etc/fstab represents a file system. Each line consists of 6 fields. Lines beginning with a "#" are comments.
The image below shows an example fstab with various comments.

045.etc-fstab.jpg

A file system can be entered either with its device name (/dev/sda7) or with its UUID. The UUID has the advantage that it does not change if, for example, a hard disk is plugged into a different SATA port or several USB sticks are plugged into a computer. The UUID of a partition or a USB stick can be read out with blkid.

The first line is the root filesystem of the system.
In the example, a UUID was entered in the first field for the file system. In the second field, the directory is specified where the file system is mounted. The third field contains information about the type of the file system. A specific type (e.g. ext4) can be entered here, but automatic detection using the "auto" option is advisable for removable disks. Options can be passed in the fourth field. The fifth field is required for data backups with the dump program. dump should not be used on Linux systems. The gap is only necessary to maintain compatibility.

Field 6 defines when and if the file systems are checked when the system is booted.
0 - No check (especially for removeable media)
1 - Will be checked first
2 - Will be checked afterwards.

Why do /dev/sdb and /dev/sdc also appear in this table?
Normally file systems are always written in partitions, I have come across enough USB sticks where access to e.g. /dev/sdb1 was not possible. But it was possible to mount them via /dev/sdb without any problems.

The exact number of options available in field 4 depends on which file system is used. So here are just a few examples:
noauto - file system is not mounted at boot time
nodev - Device files within this filesystem are ignored.
noexec - An executable file can be started from the file system. (Caution: This also applies to bash scripts, for example!!)
exec - Executable files can be started from the file system. Is required, for example, to start bash scripts from a USB stick.
rw - Read/Write
ro - Read Only
user - Normal users are allowed to mount the file system. The user who mounted the file system can also unmount it.
users - Normal users are allowed to mount the file system. All users are allowed to unmount it again.

Coin Marketplace

STEEM 0.18
TRX 0.13
JST 0.028
BTC 57459.32
ETH 3055.56
USDT 1.00
SBD 2.30