Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| elearning:workbooks:redhat:rh124en:l100 [2024/10/11 09:38] – admin | elearning:workbooks:redhat:rh124en:l100 [2024/11/22 17:46] (Version actuelle) – admin | ||
|---|---|---|---|
| Ligne 5: | Ligne 5: | ||
| Last update : ~~LASTMOD~~ | Last update : ~~LASTMOD~~ | ||
| - | ======RH12401 - File System====== | + | ======RH12401 - File Hierarchy |
| - | =====Module content===== | + | =====Contents===== |
| - | * **RH12401 - File System** | + | * **RH12401 - File Hierarchy |
| - | * Module content | + | * Contents |
| + | * Set Up your Keyboard | ||
| * LAB #1 - Linux File Hierarchy System | * LAB #1 - Linux File Hierarchy System | ||
| - | | + | |
| - | * 1.2 - The mount command | + | * 1.2 - The mount command |
| - | * 1.3 - The umount command | + | * 1.3 - The umount command |
| - | * 1.4 - The /etc/fstab file | + | * 1.4 - The /etc/fstab file |
| - | * Mount Options | + | * Mount Options |
| * LAB #2 - Unix File System | * LAB #2 - Unix File System | ||
| - | | + | |
| - | * 2.2 - Inodes | + | * 2.2 - Inodes |
| - | * 2.3 - Data blocks | + | * 2.3 - Data blocks |
| - | * 2.4 - Physical links | + | * 2.4 - Physical links |
| - | * 2.5 - Symbolic links | + | * 2.5 - Symbolic links |
| + | |||
| + | =====Set Up your Keyboard===== | ||
| + | |||
| + | The current keyboard layout of the Red Hat 9.4 VM is **fr** : | ||
| + | |||
| + | < | ||
| + | [root@redhat9 ~]# localectl status | ||
| + | System Locale: LANG=en_US.UTF-8 | ||
| + | VC Keymap: fr | ||
| + | X11 Layout: fr,us | ||
| + | X11 Variant: , | ||
| + | </ | ||
| + | |||
| + | Find the appropriate keymap for your host PC: | ||
| + | |||
| + | < | ||
| + | [root@redhat9 ~]# localectl list-keymaps | ||
| + | ANSI-dvorak | ||
| + | adnw | ||
| + | al | ||
| + | al-plisi | ||
| + | amiga-de | ||
| + | amiga-us | ||
| + | apple-a1048-sv | ||
| + | apple-a1243-sv | ||
| + | apple-a1243-sv-fn-reverse | ||
| + | apple-internal-0x0253-sv | ||
| + | apple-internal-0x0253-sv-fn-reverse | ||
| + | applkey | ||
| + | at | ||
| + | at-mac | ||
| + | at-nodeadkeys | ||
| + | atari-de | ||
| + | atari-se | ||
| + | atari-uk-falcon | ||
| + | atari-us | ||
| + | az | ||
| + | azerty | ||
| + | ba | ||
| + | ba-alternatequotes | ||
| + | ba-unicode | ||
| + | ba-unicodeus | ||
| + | ba-us | ||
| + | backspace | ||
| + | bashkir | ||
| + | be | ||
| + | be-iso-alternate | ||
| + | be-latin1 | ||
| + | be-nodeadkeys | ||
| + | be-oss | ||
| + | be-oss_latin9 | ||
| + | be-wang | ||
| + | bg-cp1251 | ||
| + | bg-cp855 | ||
| + | bg_bds-cp1251 | ||
| + | bg_bds-utf8 | ||
| + | bg_pho-cp1251 | ||
| + | bg_pho-utf8 | ||
| + | bone | ||
| + | br | ||
| + | br-abnt | ||
| + | br-abnt2 | ||
| + | br-dvorak | ||
| + | br-latin1-abnt2 | ||
| + | br-latin1-us | ||
| + | br-nativo | ||
| + | br-nativo-epo | ||
| + | br-nativo-us | ||
| + | br-nodeadkeys | ||
| + | br-thinkpad | ||
| + | by | ||
| + | by-cp1251 | ||
| + | by-latin | ||
| + | bywin-cp1251 | ||
| + | ca | ||
| + | lines 1-58 | ||
| + | </ | ||
| + | |||
| + | Before you start, configure your keyboard accordingly. For example in the case of a **US** layout: | ||
| + | |||
| + | < | ||
| + | [root@redhat9 ~]# localectl set-keymap us | ||
| + | |||
| + | [root@redhat9 ~]# localectl status | ||
| + | System Locale: LANG=en_US.UTF-8 | ||
| + | VC Keymap: us | ||
| + | X11 Layout: us | ||
| + | X11 Model: pc105+inet | ||
| + | X11 Options: terminate: | ||
| + | </ | ||
| =====LAB #1 - Linux File Hierarchy System===== | =====LAB #1 - Linux File Hierarchy System===== | ||
| Ligne 54: | Ligne 145: | ||
| </ | </ | ||
| - | * **/afs**: Andrew File System (AFS) is a distributed file system that uses a set of trusted servers to present a consistent, location-transparent file namespace. | + | | **/ |
| - | | + | | **/ |
| - | | + | | **/ |
| - | | + | | **/ |
| - | | + | | **/ |
| - | | + | | **/ |
| - | | + | | **/ |
| - | | + | | **/ |
| - | | + | | **/ |
| - | | + | | **/ |
| - | | + | | **/ |
| - | | + | | **/ |
| - | | + | | **/ |
| - | | + | | **/ |
| - | | + | | **/ |
| - | | + | | **/ |
| - | | + | | **/ |
| - | | + | | **/ |
| - | | + | | **/ |
| - | | + | | **/ |
| - | ====1.1 - File Types==== | + | Graphically, |
| - | There are three main types of file on the Linux system: | + | {{ :elearning: |
| - | * ordinary files | + | ====1.1 - File Types==== |
| - | * directories | + | |
| - | * special files (or Devices). | + | |
| - | Ordinary files are text files, tables or executables. | + | The three major file types under Linux are : |
| - | The length of the file name is limited to 255 characters. | + | * Ordinary files, |
| + | * Directories, | ||
| + | * Special files or Devices. | ||
| - | There is a distinction between upper and lower case. | + | Note that : |
| - | If a file name begins | + | * Ordinary files can be anything from text files to binaries. |
| + | * The length of a file name is limited to 225 characters, including the file extension. | ||
| + | * Linux is case sensitive. | ||
| + | * If a file name starts | ||
| ====1.2 - The mount command==== | ====1.2 - The mount command==== | ||
| - | 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: | + | In order to be able to use external file systems, such as a CDRom or DVDRom, |
| - | # mount / | + | # mount / |
| - | where **/ | + | where **/ |
| - | If the **mount** command is used without options, the system returns a list of all the file systems | + | In the case where the **mount** command is used without options, the current mounted |
| < | < | ||
| Ligne 177: | Ligne 271: | ||
| # umount /dev/cdrom | # umount /dev/cdrom | ||
| - | ====1.4 - The /etc/fstab file | + | ====1.4 - The /etc/fstab file==== |
| - | If the **mount** command is used with the **-a** option, all the file systems listed in a special | + | If the **mount** command is used with the **-a** option, all the file systems listed in the file called **/ |
| < | < | ||
| - | [root@redhat9 ~]# cat /etc/fstab==== | + | [root@redhat9 ~]# cat /etc/fstab |
| # | # | ||
| Ligne 202: | Ligne 296: | ||
| ^ Field 1 ^ Field 2 ^ Field 3 ^ Field 4 ^ Field 5 ^ Field 6 ^ | ^ 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 dumper, 0 or empty = to ignore ) | The order in which //fsck// checks file systems at boot time | | + | | 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** ( // | The **UUID** ( // | ||
| Ligne 210: | Ligne 304: | ||
| The most important mount options are : | The most important mount options are : | ||
| - | ^ Option ^ Filesystems | + | ^ Option ^ Filesystem |
| - | | defaults | All | Equal to rw, suid, dev, exec, auto, nouser, async | N/A | + | | defaults | All | Use default options: |
| - | | auto/noauto | All | Automatic mount/no automatic | + | | auto/noauto | All | Do or do not mount when "mount -a" is given. |
| - | | rw/ro | All | Mount read-write/ | + | | rw/ro | All | Mount the filesystem |
| - | | suid/nosuid | All | SUID and SGID bits are/are not taken into account | + | | suid/nosuid | All | Allow/disallow set-user-identifier or set-group-identifier bits to take effect. |
| - | | dev/nodev | All | Interprets/does not interpret special | + | | dev/nodev | All | Interpret/do not interpret |
| - | | exec/noexec | All | Allow:do not allow programs to run | exec | | + | | exec/noexec | All | Permit/do not permit execution of binaries. |
| - | | sync/async | All | Synchronous/asynchronous mount | async | | + | | sync/async | All | All I/O to the filesystem should be done synchronously/ |
| - | | user/nouser | All | Allow/ | + | | user/nouser | All | Allow/ |
| - | | users | All | Authorise all users to mount/unmount the file system | + | | users | All | Allow every user |
| - | | owner | All | Allows the owner of the device to mount it | N/A | | + | | owner | All | Allow device |
| - | | atime/ | + | | atime/ |
| - | | uid=value | Non-Linux | + | | uid=value | Non-Linux |
| - | | gid=value | Non-Linux | + | | gid=value | Non-Linux |
| - | | umask=value | Non-Linux | + | | umask=value | Non-Linux |
| - | | dmask=value | Non-Linux | + | | dmask=value |
| - | | dir_mode=value | Non-Linux | + | | dir_mode=value |
| - | | fmask=value | Non-Linux | + | | fmask=value |
| - | | file_mode=value | Non-Linux | + | | file_mode=value |
| =====LAB #2 - Unix File System===== | =====LAB #2 - Unix File System===== | ||
| - | Each partition on a Unix system | + | Each file system |
| - | * superbloc | + | * Superblock |
| - | * inode | + | * Inodes |
| - | * data block | + | * Data blocks |
| - | * indirection | + | * Indirect |
| ====2.1 - Superblock==== | ====2.1 - Superblock==== | ||
| Ligne 252: | Ligne 346: | ||
| ====2.2 - Inodes==== | ====2.2 - Inodes==== | ||
| - | Each file is represented by an **inode**. | + | Each file is represented by an **inode**. |
| - | * the type of file, i.e. **-**, **d**, **l**, **b**, **c**, **p**, **s** | + | * the file type : **-**, **d**, **l**, **b**, **c**, **p**, **s**, |
| - | * access rights, for example **rwx rw- r--** | + | * file permissions, for example |
| - | * the number of physical | + | * the number of hard links, |
| - | * the creator's UID or the UID assigned | + | * the UID of the file creator or the current |
| - | * the GID of the creator | + | * the GID of the creating |
| - | * the size of the file in bytes | + | * the file size in bytes, |
| - | * the date on which the inode was last modified, i.e. **ctime**. | + | * the date of the last modification of the file's inode content : **ctime**, |
| - | * the date on which the file was last modified, i.e. **mtime**. | + | * the date of the last modification of the file contents : **mtime**, |
| - | * the date of the last access, i.e. **atime**. | + | * the date of the last access |
| - | * the addresses | + | * allocation |
| - | + | ||
| - | Graphically, | + | |
| - | + | ||
| - | {{ : | + | |
| To understand this better, type the following command: | To understand this better, type the following command: | ||
| Ligne 281: | Ligne 371: | ||
| The first character of each line can be one of the following: | The first character of each line can be one of the following: | ||
| - | | + | * - - an ordinary |
| - | | + | * d - a directory, |
| - | | + | * l - a symbolic link, |
| - | | + | * b - a bloc type peripheral, |
| - | | + | * c - a character |
| - | | + | * p - a named pipe for communication |
| - | | + | * s - a network |
| To view the inode number, use the **-i** option: | To view the inode number, use the **-i** option: | ||
| Ligne 301: | Ligne 391: | ||
| ====2.3 - Data blocks==== | ====2.3 - Data blocks==== | ||
| - | Data is stored in data blocks. In the case of a directory, the data block contains a table which references the inodes and file names in the directory. This table is called a **catalogue | + | Data is stored in data blocks. In the case of a directory, the data block contains a table which references the inodes and file names in the directory. This table is called a **catalog |
| - | The name of a file is not stored in the inode but in a **catalogue | + | The name of a file is not stored in the inode but in a **catalog |
| ====2.4 - Physical (hard) links==== | ====2.4 - Physical (hard) links==== | ||
| Ligne 325: | Ligne 415: | ||
| 33625154 -rw-r--r--. 1 root root 0 Sep 25 13:08 file1 | 33625154 -rw-r--r--. 1 root root 0 Sep 25 13:08 file1 | ||
| - | Now create | + | Now create |
| < | < | ||
| Ligne 344: | Ligne 434: | ||
| Both files, file1 and file2, are referenced by the same inode. The number of links is therefore increased by 1 (the number in the third field). | Both files, file1 and file2, are referenced by the same inode. The number of links is therefore increased by 1 (the number in the third field). | ||
| - | < | + | < |
| **Important**: | **Important**: | ||
| </ | </ | ||
| Ligne 354: | Ligne 444: | ||
| * ln -s filename shortcut_name | * ln -s filename shortcut_name | ||
| - | To illustrate this point, type the following command | + | To illustrate this point, type the following command: |
| < | < | ||
| Ligne 370: | Ligne 460: | ||
| <WRAP center round important 60%> | <WRAP center round important 60%> | ||
| - | **Important**: | + | **Important**: |
| </ | </ | ||
| ----- | ----- | ||
| Copyright © 2024 Hugh Norris. | Copyright © 2024 Hugh Norris. | ||