Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédente | |||
elearning:workbooks:redhat:rh124:l100 [2024/11/04 10:50] – admin | elearning:workbooks:redhat:rh124:l100 [2024/11/15 07:59] (Version actuelle) – old revision restored (2024/09/25 12:12) admin | ||
---|---|---|---|
Ligne 3: | Ligne 3: | ||
Version : **2024.01** | Version : **2024.01** | ||
- | Last update | + | Dernière mise-à-jour |
- | ======RH12401 - File System====== | + | ======RH12401 - Système de Fichiers====== |
- | =====Contents===== | + | =====Contenu du Module===== |
- | * **RH12401 - File System** | + | * **RH12401 - Système de Fichiers** |
- | * Contents | + | * Contenu du Module |
* LAB #1 - Linux File Hierarchy System | * LAB #1 - Linux File Hierarchy System | ||
- | * 1.1 - File Types | + | * 1.1 - Types de Fichiers |
- | * 1.2 - The mount command | + | * 1.2 - La Commande |
- | * 1.3 - The umount | + | * 1.3 - La Commande |
- | * 1.4 - The / | + | * 1.4 - Le Fichier |
- | * Mount Options | + | * Options |
- | * LAB #2 - Unix File System | + | * LAB #2 - Système de Fichiers |
- | * 2.1 - Superblock | + | * 2.1 - Superbloc |
* 2.2 - Inodes | * 2.2 - Inodes | ||
- | * 2.3 - Data blocks | + | * 2.3 - Blocs de données |
- | * 2.4 - Physical links | + | * 2.4 - Liens Physiques |
- | * 2.5 - Symbolic links | + | * 2.5 - Liens Symboliques |
=====LAB #1 - Linux File Hierarchy System===== | =====LAB #1 - Linux File Hierarchy System===== | ||
- | The Linux file system is organised around a single tree with a starting | + | Le système de fichiers de Linux est organisé autour d'une arborescence unique ayant un point de départ appelé la **racine**, représenté par le caractère |
< | < | ||
Ligne 32: | Ligne 32: | ||
[trainee@redhat9 /]$ ls -l | [trainee@redhat9 /]$ ls -l | ||
total 28 | total 28 | ||
- | dr-xr-xr-x. 2 root root 6 Aug 10 2021 afs | + | dr-xr-xr-x. |
- | lrwxrwxrwx. 1 root root 7 Aug 10 2021 bin -> usr/bin | + | lrwxrwxrwx. |
- | dr-xr-xr-x. 5 root root 4096 Sep 25 12:30 boot | + | dr-xr-xr-x. |
- | drwxr-xr-x. 20 root root 3320 Sep 25 12:44 dev | + | drwxr-xr-x. |
drwxr-xr-x. 133 root root 8192 Sep 25 12:44 etc | drwxr-xr-x. 133 root root 8192 Sep 25 12:44 etc | ||
- | drwxr-xr-x. 3 root root 21 Oct 19 2023 home | + | drwxr-xr-x. |
- | lrwxrwxrwx. 1 root root 7 Aug 10 2021 lib -> usr/lib | + | lrwxrwxrwx. |
- | lrwxrwxrwx. 1 root root 9 Aug 10 2021 lib64 -> usr/lib64 | + | lrwxrwxrwx. |
- | drwxr-xr-x. 2 root root 6 Aug 10 2021 media | + | drwxr-xr-x. |
- | drwxr-xr-x. 2 root root 6 Aug 10 2021 mnt | + | drwxr-xr-x. |
- | drwxr-xr-x. 2 root root 6 Aug 10 2021 opt | + | drwxr-xr-x. |
- | dr-xr-xr-x. 242 root root 0 Sep 25 12:44 proc | + | dr-xr-xr-x. 242 root root 0 Sep 25 12:44 proc |
- | dr-xr-x---. 4 root root 4096 Oct 19 2023 root | + | dr-xr-x---. |
- | drwxr-xr-x. 44 root root 1160 Sep 25 12:44 run | + | drwxr-xr-x. |
- | lrwxrwxrwx. 1 root root 8 Aug 10 2021 sbin -> usr/sbin | + | lrwxrwxrwx. |
- | drwxr-xr-x. 2 root root 6 Aug 10 2021 srv | + | drwxr-xr-x. |
- | dr-xr-xr-x. 13 root root 0 Sep 25 12:44 sys | + | dr-xr-xr-x. |
- | drwxrwxrwt. 15 root root 4096 Sep 25 12:48 tmp | + | drwxrwxrwt. |
- | drwxr-xr-x. 12 root root 144 Oct 19 2023 usr | + | drwxr-xr-x. |
- | drwxr-xr-x. 20 root root 4096 Oct 19 2023 var | + | drwxr-xr-x. |
</ | </ | ||
- | * **/afs**: Andrew File System (AFS) is a distributed file system that uses a set of trusted servers to present a consistent, location-transparent | + | * **/afs** : Andrew File System (AFS) est un système de fichiers distribué qui utilise un ensemble de serveurs de confiance pour présenter un espace de noms de fichiers homogène et transparent |
- | * **/ | + | * **/bin** : est une abréviation de // |
- | * **/ | + | * **/boot** : contient les fichiers nécessaires au démarrage du système. |
- | * **/ | + | * **/dev** : contient les nœuds utilisés pour accéder à tout type de matériel tel / |
- | * **/ | + | * **/etc** : contient des fichiers de configuration |
- | * **/ | + | * **/home** : contient les répertoires de chaque utilisateur sauf l’utilisateur |
- | * **/ | + | * **/lib** : contient les bibliothèques |
- | * **/ | + | * **/lib64** : contient les bibliothèques |
- | * **/ | + | * **/media** : contient des répertoires pour chaque système de fichiers monté |
- | * **/ | + | * **/mnt** : contient des répertoires pour chaque système de fichiers monté temporairement par root. |
- | * **/ | + | * **/opt** : contient des applications |
- | * **/ | + | * **/proc** : contient un système de fichiers virtuel qui extrait de la mémoire les informations en cours de traitement. Le contenu des fichiers est créé dynamiquement lors de la consultation. |
- | * **/ | + | * **/root** : le home de root, l’administrateur système. |
- | * **/ | + | * **/run** : remplace le répertoire |
- | * **/ | + | * **/sbin** : contient des binaires, donc programmes, |
- | * **/ | + | * **/srv** : contient des données pour les **s**e**r****v**ices |
- | * **/ | + | * **/sys** : contient un système de fichiers virtuel dont le rôle est de décrire le matériel pour udev. |
- | * **/ | + | * **/tmp** : stocke des fichiers temporaires créés par des programmes. |
- | * **/ | + | * **/usr** : contient des commandes des utilisateurs dans / |
- | * **/ | + | * **/var** : contient des fichiers de taille |
- | ====1.1 - File Types==== | + | ====1.1 - Types de Fichiers==== |
- | There are three main types of file on the Linux system: | + | Il existe trois types majeurs de fichier sous le système |
- | * ordinary files | + | * les fichiers normaux ( ordinary files ) |
- | * directories | + | |
- | * special files (or Devices). | + | |
- | Ordinary files are text files, tables or executables. | + | * les répertoires ( directories ) |
- | The length of the file name is limited to 255 characters. | + | * les fichiers spéciaux ( special files ou Devices) |
- | There is a distinction between upper and lower case. | + | Le fichiers normaux sont des fichiers textes, des tableaux ou des exécutables. |
- | If a file name begins with **.**, the file becomes hidden. | + | La longueur du nom de fichier est limité à 255 caractères. |
- | ====1.2 - The mount command==== | + | Il y a une distinction entres les majuscules et le minuscules. |
- | In order for Linux to be informed of the presence of a file system, this system must be mounted. To mount a file system, use the **mount** command: | + | Si le nom d'un fichier commence par un **.**, le fichier devient caché. |
- | # mount / | + | ====1.2 - La Commande |
- | where **/ | + | Pour que Linux soit informé de la présence d’un système de fichiers, ce système doit être monté. Pour monter un système de fichiers, on utilise la commande |
- | If the **mount** | + | # mount / |
+ | |||
+ | ou **/ | ||
+ | |||
+ | Dans le cas où la commande | ||
< | < | ||
Ligne 132: | Ligne 134: | ||
</ | </ | ||
- | This information | + | Cette information |
< | < | ||
Ligne 164: | Ligne 166: | ||
<WRAP center round important 60%> | <WRAP center round important 60%> | ||
- | **Important**: | + | **Important** : Notez que le système de fichiers de / |
</ | </ | ||
- | ====1.3 - The umount | + | ====1.3 - La Commande |
- | To unmount a file system, use the umount | + | Pour démonter un système de fichiers, on utilise la commande |
- | # umount /mnt/<target_directory> | + | # umount /mnt/<répertoire_cible> |
- | or | + | ou |
# umount /dev/cdrom | # umount /dev/cdrom | ||
- | ====1.4 - The / | + | ====1.4 - Le Fichier |
- | If the **mount** | + | Dans le cas où la commande |
< | < | ||
Ligne 188: | Ligne 190: | ||
# Created by anaconda on Thu Oct 19 16:05:58 2023 | # Created by anaconda on Thu Oct 19 16:05:58 2023 | ||
# | # | ||
- | # Accessible filesystems, | + | # Accessible filesystems, |
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info. | # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info. | ||
# | # | ||
- | # After editing this file, run ‘systemctl daemon-reload’ to update systemd | + | # After editing this file, run 'systemctl daemon-reload' |
# units generated from this file. | # units generated from this file. | ||
# | # | ||
- | / | + | / |
- | UUID=6f6c5bb9-30be-4734-bc23-03fed8541616 /boot xfs defaults 0 0 | + | UUID=6f6c5bb9-30be-4734-bc23-03fed8541616 /boot |
- | / | + | / |
</ | </ | ||
- | Each line in this file contains | + | Chaque ligne dans ce fichier contient |
- | + | ||
- | ^ Field 1 ^ Field 2 ^ Field 3 ^ Field 4 ^ Field 5 ^ Field 6 ^ | + | |
- | | Special block file or UUID or virtual file system or a label | Mount point | File system type | Comma separated options | Used by //dump// ( 1 = to dump, 0 or empty = to ignore ) | The order in which //fsck// checks file systems at boot time | | + | |
- | The **UUID** ( //Universally Unique Identifier// ) is a 128-bit string. UUIDs are created automatically and at random when the filesystem is created on the partition. They can be modified by the administrator. | + | ^ Champ 1 ^ Champ 2 ^ Champ 3 ^ Champ 4 ^ Champ 5 ^ Champ 6 ^ |
+ | | Fichier de bloc spécial ou UUID ou système de fichiers virtuel ou une étiquette | ||
- | ===Mount Options=== | + | L' |
+ | |||
+ | ===Options | ||
- | The most important mount options | + | Les options |
- | ^ Option ^ Filesystems | + | ^ Option ^ Systèmes de Fichier |
- | | defaults | All | Equal to rw, suid, dev, exec, auto, nouser, async | N/A | | + | | defaults | Tous | Egal à rw, suid, dev, exec, auto, nouser, async | S/O | |
- | | auto/noauto | All | Automatic mount/no automatic mount when using **mount -a** | auto | | + | | auto/noauto | Tous | Montage automatique/pas de montage automatique lors de l' |
- | | rw/ro | All | Mount read-write/read-only | + | | rw/ro | Tous | Montage en lecture-écriture/lecture seule | rw | |
- | | suid/nosuid | All | SUID and SGID bits are/are not taken into account | + | | suid/nosuid | Tous | Les bits SUID et SGID sont/ne sont pas pris en compte |
- | | dev/nodev | All | Interprets/does not interpret special device files | dev | | + | | dev/nodev | Tous | Interprète/n' |
- | | exec/noexec | All | Allow/do not allow programs to run | exec | | + | | exec/noexec | Tous | Autorise: |
- | | sync/async | All | Synchronous/asynchronous mount | async | | + | | sync/async | Tous | Montage synchrone/asynchrone |
- | | user/nouser | All | Allow/disallow a user to mount/dismount the file system. The mount point is the one specified in / | + | | user/nouser | Tous | Autorise/n' |
- | | users | All | Authorise all users to mount/unmount the file system | + | | users | Tous | Autorise tous les utilisateurs à monter/démonter le système de fichier |
- | | owner | All | Allows the owner of the device to mount it | N/A | | + | | owner | Tous | Autorise le propriétaire du périphérique de le monter |
- | | atime/ | + | | atime/ |
- | | uid=value | Non-Linux | + | | uid=valeur |
- | | gid=value | Non-Linux | + | | gid=valeur |
- | | umask=value | Non-Linux | + | | umask=valeur |
- | | dmask=value | Non-Linux | + | | dmask=valeur |
- | | dir_mode=value | Non-Linux | + | | dir_mode=valeur |
- | | fmask=value | Non-Linux | + | | fmask=valeur |
- | | file_mode=value | Non-Linux | + | | file_mode=valeur |
- | =====LAB #2 - Unix File System===== | + | =====LAB #2 - Système de Fichiers |
- | Each partition | + | Chaque |
- | * superblock | + | * superbloc |
- | * inodes | + | * inode |
- | * data block | + | * bloc de données |
- | * indirection | + | * blocs d'indirection |
- | ====2.1 - Superblock==== | + | ====2.1 - Superbloc==== |
- | The superblock contains: | + | Le superbloc contient |
- | * the size of the blocks | + | * la taille des blocs |
- | * the size of the file system | + | * la taille du système de fichiers |
- | * the number of mounts performed for this file system | + | * le nombre de montages effectués pour ce système de fichiers |
- | * a pointer to the root of the file system | + | * un pointeur vers la racine du système de fichiers |
- | * pointers to the list of free inodes | + | * les pointeurs vers la liste des inodes |
- | * pointers to the list of free data blocks | + | * les pointeurs vers la liste des blocs de données libres |
====2.2 - Inodes==== | ====2.2 - Inodes==== | ||
- | Each file is represented by an **inode**. | + | Chaque fichier est représenté par un **inode**. |
- | * the type of file, i.e. **-**, **d**, **l**, **b**, **c**, **p**, **s** | + | * le type de fichier, soit **-**, **d**, **l**, **b**, **c**, **p**, **s** |
- | * access rights, for example | + | * les droits d' |
- | * the number of physical links, i.e. the number of names | + | * le nombre de liens physiques soit le nombre de noms |
- | * the creator's UID or the UID assigned by the **chown** | + | * l' |
- | * the GID of the creator process or the GID assigned by the **chgrp** | + | * le GID du processus créateur ou le GID affecté par la commande |
- | * the size of the file in bytes | + | * la taille du fichier en octets |
- | * the date on which the inode was last modified, i.e. **ctime**. | + | * la date de dernière modification de l'inode, |
- | * the date on which the file was last modified, i.e. **mtime**. | + | * la date de dernière modification du fichier, soit le **mtime** |
- | * the date of the last access, i.e. **atime**. | + | * la date du dernier accès, soit le **atime** |
- | * the addresses which point to the data blocks in the file. | + | * les adresses qui pointent vers les blocs de données du fichier |
- | Graphically, this organisation | + | Graphiquement, on peut schématiser cette organisation |
{{ : | {{ : | ||
- | To understand this better, type the following command: | + | Pour mieux comprendre, tapez la commande suivante |
< | < | ||
[root@redhat9 ~]# ls -ld / | [root@redhat9 ~]# ls -ld / | ||
- | crw--w----. 1 root tty 5, 1 Sep 25 12:44 / | + | crw--w----. |
- | brw-rw----. 1 root disk 8, 1 Sep 25 12:44 /dev/sda1 | + | brw-rw----. |
drwxr-xr-x. 133 root root 8192 Sep 25 12:44 /etc | drwxr-xr-x. 133 root root 8192 Sep 25 12:44 /etc | ||
- | -rw-r--r--. 1 root root 2109 Oct 19 2023 /etc/passwd | + | -rw-r--r--. |
</ | </ | ||
- | The first character of each line can be one of the following: | + | Le premier caractère de chaque ligne peut être un des suivants |
- | * **-** - a file | + | * **-** - un fichier |
- | * **d** - a directory | + | * **d** - un répertoire |
- | * **l** - a symbolic link | + | * **l** - un lien symbolique |
- | * **b** - a block device | + | * **b** - un périphérique du type bloc |
- | * **c** - a character device | + | * **c** - un périphérique du type caractère |
- | * **p** - a named pipe for inter-process | + | * **p** - un tube nommé pour la communication |
- | * **s** - a socket | + | * **s** - un socket |
- | To view the inode number, use the **-i** | + | Pour visualiser le numéro d'inode, |
< | < | ||
[root@redhat9 ~]# ls -ldi / | [root@redhat9 ~]# ls -ldi / | ||
- | 12 crw--w----. 1 root tty 5, 1 Sep 25 12:44 / | + | |
- | 273 brw-rw----. 1 root disk 8, 1 Sep 25 12:44 /dev/sda1 | + | |
67154049 drwxr-xr-x. 133 root root 8192 Sep 25 12:44 /etc | 67154049 drwxr-xr-x. 133 root root 8192 Sep 25 12:44 /etc | ||
- | 68914044 -rw-r--r--. 1 root root 2109 Oct 19 2023 /etc/passwd | + | 68914044 -rw-r--r--. |
</ | </ | ||
- | ====2.3 - Data blocks==== | + | ====2.3 - Blocs de données==== |
- | Data is stored in data blocks. In the case of a directory, the data block contains a table which references the inodes | + | Les données sont stockées dans des blocs de données. Dans le cas d'un répertoire, le bloc de données contient une table qui référence les inodes |
- | The name of a file is not stored in the inode but in a **catalogue | + | Le nom d'un fichier n'est pas stocké dans l'inode mais dans une **table |
- | ====2.4 - Physical (hard) links==== | + | ====2.4 - Liens Physiques==== |
- | A physical or hard link is created using the following command: | + | Un lien physique se crée en utilisant la commande suivante |
- | * ln file_name additional_name | + | * ln nom_du_fichier nom_supplémentaire |
- | To illustrate this point, | + | Pour illustrer ce point, |
< | < | ||
- | [root@redhat9 ~]# cd /tmp; mkdir inode; cd inode; touch file1; ls -ali | + | [root@redhat9 ~]# cd /tmp; mkdir inode; cd inode; touch fichier1; ls -ali |
total 4 | total 4 | ||
- | 33625083 drwxr-xr-x. 2 root root 22 Sep 25 13:08 . | + | 33625083 drwxr-xr-x. |
- | 33554561 drwxrwxrwt. 16 root root 4096 Sep 25 13:08 . | + | 33554561 drwxrwxrwt. 16 root root 4096 Sep 25 13:08 .. |
- | 33625154 -rw-r--r--. 1 root root 0 Sep 25 13:08 file1 | + | 33625154 -rw-r--r--. |
</ | </ | ||
- | Note the inode number of the file **file1**. Also note that the number in the third field of the file1 line has the value **1** : | + | Notez bien le numéro de l'inode du fichier |
- | | + | 33625154 -rw-r--r--. |
- | Now create a physical link : | + | Créez maintenant un lien physique |
< | < | ||
- | [root@redhat9 inode]# ln file1 file2 | + | [root@redhat9 inode]# ln fichier1 fichier2 |
[root@redhat9 inode]# ls -ali | [root@redhat9 inode]# ls -ali | ||
total 4 | total 4 | ||
- | 33625083 drwxr-xr-x. 2 root root 38 Sep 25 13:09 . | + | 33625083 drwxr-xr-x. |
- | 33554561 drwxrwxrwt. 16 root root 4096 Sep 25 13:08 . | + | 33554561 drwxrwxrwt. 16 root root 4096 Sep 25 13:08 .. |
- | 33625154 -rw-r--r--. 2 root root 0 Sep 25 13:08 file1 | + | 33625154 -rw-r--r--. |
- | 33625154 -rw-r--r--. 2 root root 0 Sep 25 13:08 file2 | + | 33625154 -rw-r--r--. |
</ | </ | ||
- | Note the following two lines: | + | Notez les deux lignes suivantes |
- | 33625154 -rw-r--r--. 2 root root 0 Sep 25 13:08 file1\\ | + | |
- | 33625154 -rw-r--r--. 2 root root 0 Sep 25 13:08 file2 | + | 33625154 -rw-r--r--. |
- | Both files, file1 and file2, are referenced by the same inode. | + | Les deux fichiers, fichier1 et fichier2, sont référencés par le même inode. |
<WRAP center round important 60%> | <WRAP center round important 60%> | ||
- | **Important**: | + | **Important** : Un lien physique ne peut être créé que dans le cas où les deux fichiers se trouvent dans le même filesystem |
</ | </ | ||
- | ====2.5 - Symbolic Links==== | + | ====2.5 - Liens Symboliques==== |
- | A symbolic link is a **shortcut** to another file or directory. A symbolic link is created using the following command: | + | Un lien symbolique est un **raccourci** vers un autre fichier ou répertoire. Un lien symbolique se crée en utilisant la commande suivante |
- | * ln -s filename shortcut_name | + | * ln -s nom_du_fichier nom_raccourci |
- | To illustrate this point, | + | Pour illustrer ce point, |
< | < | ||
- | [root@redhat9 inode]# ln -s file1 file3 | + | [root@redhat9 inode]# ln -s fichier1 fichier3 |
[root@redhat9 inode]# ls -ali | [root@redhat9 inode]# ls -ali | ||
total 4 | total 4 | ||
- | 33625083 drwxr-xr-x. 2 root root 54 Sep 25 13:10 . | + | 33625083 drwxr-xr-x. |
- | 33554561 drwxrwxrwt. 16 root root 4096 Sep 25 13:08 . | + | 33554561 drwxrwxrwt. 16 root root 4096 Sep 25 13:08 .. |
- | 33625154 -rw-r--r--. 2 root root 0 Sep 25 13:08 file1 | + | 33625154 -rw-r--r--. |
- | 33625154 -rw-r--r--. 2 root root 0 Sep 25 13:08 file2 | + | 33625154 -rw-r--r--. |
- | 33625156 lrwxrwxrwx. 1 root root 8 Sep 25 13:10 file3 -> file1 | + | 33625156 lrwxrwxrwx. |
</ | </ | ||
- | Note that the symbolic link is referenced by another | + | Notez que le lien symbolique est référencé par un autre inode. |
<WRAP center round important 60%> | <WRAP center round important 60%> | ||
- | **Important**: | + | **Important** : Un lien symbolique peut être créé même dans le cas où les deux fichiers se trouvent dans deux filesystems |
</ | </ | ||
----- | ----- | ||
Copyright © 2024 Hugh Norris. | Copyright © 2024 Hugh Norris. |