Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
elearning:workbooks:redhat:rh124en:l100 [2024/11/11 14:51] adminelearning: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 System=====
  
 =====Contents===== =====Contents=====
  
-  * **RH12401 - File System**+  * **RH12401 - File Hierarchy System**
     * Contents     * Contents
 +    * Set Up your Keyboard
     * LAB #1 - Linux File Hierarchy System     * LAB #1 - Linux File Hierarchy System
       * 1.1 - File Types       * 1.1 - File Types
Ligne 23: Ligne 24:
       * 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** :
 +
 +<code>
 +[root@redhat9 ~]# localectl status
 +System Locale: LANG=en_US.UTF-8
 +    VC Keymap: fr
 +   X11 Layout: fr,us
 +  X11 Variant: ,
 +</code>
 +
 +Find the appropriate keymap for your host PC:
 +
 +<code>
 +[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
 +</code>
 +
 +Before you start, configure your keyboard accordingly. For example in the case of a **US** layout:
 +
 +<code>
 +[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:ctrl_alt_bksp
 +</code>
  
 =====LAB #1 - Linux File Hierarchy System===== =====LAB #1 - Linux File Hierarchy System=====
Ligne 54: Ligne 145:
 </code> </code>
  
-  * **/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. +**/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. | 
-  **/bin**: is short for //**bin**ary// or binaries. It contains programs such as ls. Under RHEL 9 it is a symbolic link pointing to /usr/bin.  +**/bin** | Contains user programs such as ls, cp e.t.c.. Note that under RHEL 9, this is a soft link (shortcut) to **/usr/bin**| 
-  **/boot**: contains the files needed to boot the system.  +**/boot** | Contains bootloader files, kernels and initrd (INItial Ram Disk) files. | 
-  **/dev**: contains the nodes used to access all types of hardware, such as /dev/fd0 for the floppy drive. The //udev// binary is responsible for dynamically creating and deleting nodes. +**/dev** | Contains device nodes for accessing all the peripherals and devices connected to the system. The //udev// binary takes care of dynamically creating and deleting the relevant device nodes automatically| 
-  **/etc**: contains configuration files such as passwd for passwords and fstab, which is the list of file systems to be mounted when the system boots.  +**/etc** | Contains static configuration files. | 
-  **/home**: contains the directories for each user except root.  +**/home** | Contains a directory for each registered user of the system except for root. | 
-  **/lib**: contains the shared 32-bit libraries used by programs and modules. Under RHEL 9 this is a symbolic link pointing to /usr/lib.  +**/lib** | Contains shared 32 bit libraries for applications and modules. Note that under RHEL 9this is a soft link (shortcut) to **/usr/lib**| 
-  **/lib64**: contains the shared 64-bit libraries used by programs and modules. Under RHEL 9 this is a symbolic link pointing to /usr/lib64.  +**/lib64** | Contains shared 64 bit libraries for applications and modules. Note that under RHEL 9this is a soft link (shortcut) to **/usr/lib64**| 
-  **/media**: contains directories for each mounted file system (accessible to the Linux system) such as floppycdrom etc.  +**/media** | Contains a folder for each of the mounted external file systems (CDRom DVDRomUSB Key e.t.c.)| 
-  **/mnt**: contains directories for each file system temporarily mounted by root. +**/mnt** | Contains a folder for each external file system mounted temporarily by root. | 
-  **/opt**: contains optional applications+**/opt** | Contains optional application packages| 
-  **/proc**: contains a virtual file system which extracts the information being processed from memory. The contents of the files are created dynamically during consultation. Only root can view all the information in the /proc directory+**/proc** | Contains a virtual file system that documents kernel and process status information as text files. | 
-  **/root**: the home of root, the system administrator+**/root** | The home directory of the root user| 
-  **/run**: replaces the /var/run directory. +**/run** | Replaces the /var/run directory. Note that under RHEL 9, /var/run is a soft link (shorcut) to **/run**. | 
-  * **/sbin**: contains binaries, i.e. programmes, for administering the local system. Under RHEL 9 this is a symbolic link pointing to /usr/sbin. +**/sbin** | Contains essential system administration binaries. Note that under 9this is a soft link (shortcut) to **/usr/sbin**| 
-  **/srv**: contains data for the **s**e**r****v**ices hosted by the system, such as ftp, databases, web, etc+**/srv** | Contains site specific data **s**e**r****v**ed by the system (www,ftp,databases e.t.c.) 
-  **/sys**: contains a virtual file system whose role is to describe the hardware for udev. +**/sys** | Contains a virtual file system that describes devices for //udev//| 
-  **/tmp**: stores temporary files created by programs.  +**/tmp** | Contains the temporary files created by the system and by applications| 
-  **/usr**: contains user commands in /usr/bin, HOWTOs in /usr/share/doc, manuals in /usr/share/man and other major entries+**/usr** | Contains user commands in ///usr/bin//, HOWTOs in ///usr/share/doc//, manuals in ///usr/share/man// and is the //Secondary Hierarchy// for read-only user data| 
-  **/var**: contains files of variable size.+**/var** | Contains variable files. i.e. files that continually change such as log files and spool files|
  
-====1.File Types====+Graphically, this can be represented as follows ("Standard-unix-filesystem-hierarchy.svg" by Ppgardne, Wikimedia Commons is licensed under CC BY-SA 4.0):
  
-There are three main types of file on the Linux system:+{{ :elearning:workbooks:redhat:rh124en:standard-unix-filesystem-hierarchy.png |}}
  
-  * 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 with **.**, the file becomes hidden.+  * 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 with a dot (**.**)it is a hidden file.
  
 ====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 mountedTo mount a file system, use the **mount** command:+In order to be able to use external file systems, such as a CDRom or DVDRom, Linux needs to be informed of their availabilityThis is accomplished by using the **mount** command:
  
-  # mount /dev/<special_file> /mnt/<target_directory>+  # mount /dev/<special_file> /mnt/<directory_name[Enter]
  
-where **/dev/<special_file>** is the device to be mounted and **/mnt/<target_directory>** is the directory that will be used as a ‘window’ to view the contents of the file system. This directory must exist before attempting to mount the file system.+where **/dev/<special_file>** is the file system to mount and **/mnt/<directory_name>** is the target directory where the mounted file system will be available to the system. The directory **/mnt/<directory_name>** must exist prior to using the **mount** command.
  
-If the **mount** command is used without options, the system returns a list of all the file systems currently mounted:+In the case where the **mount** command is used without options, the current mounted file systems are shown:
  
 <code> <code>
Ligne 179: Ligne 273:
 ====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 file called **/etc/fstab** will be mounted at the same time:+If the **mount** command is used with the **-a** option, all the file systems listed in the file called **/etc/fstab** will be mounted at the same time:
  
 <code> <code>
Ligne 210: Ligne 304:
 The most important mount options are : The most important mount options are :
  
-^ Option ^ Filesystems ^ Description ^ Default | +^ Option ^ Filesystem ^ Description ^ Default Value 
-| defaults | All | Equal to rw, suid, dev, exec, auto, nouser, async | N/A | +| defaults | All | Use default options: rw, suid, dev, exec, auto, nouser, and async| N/A ((Not Applicable)) 
-| auto/noauto | All | Automatic mount/no automatic mount when using **mount -a** | auto | +| auto/noauto | All | Do or do not mount when "mount -a" is given. | auto | 
-| rw/ro | All | Mount read-write/read-only | rw | +| rw/ro | All | Mount the filesystem read-write/read-only| rw | 
-| suid/nosuid | All | SUID and SGID bits are/are not taken into account | suid | +| suid/nosuid | All | Allow/disallow set-user-identifier or set-group-identifier bits to take effect. | suid | 
-| dev/nodev | All | Interprets/does not interpret special device files | dev | +| dev/nodev | All | Interpret/do not interpret character or block special devices on the filesystem. | dev | 
-| exec/noexec | All | Allow/do not allow programs to run | exec | +| exec/noexec | All | Permit/do not permit execution of binaries. | exec | 
-| sync/async | All | Synchronous/asynchronous mount | async | +| sync/async | All | All I/O to the filesystem should be done synchronously/asynchronously. | async | 
-| user/nouser | All | Allow/disallow a user to mount/dismount the file system. The mount point is the one specified in /etc/fstab. Only the user who mounted the file system can unmount it. | +| user/nouser | All | Allow/disallow a user to mount. The mount point is read from the /etc/fstab file. Only the user that mounted the filesystem can unmount it. | N/A 
-| users | All | Authorise all users to mount/unmount the file system | N/A | +| users | All | Allow  every  user  to  mount and unmount the filesystem.  | N/A | 
-| owner | All | Allows the owner of the device to mount it | N/A | +| owner | All | Allow device owner to mount| N/A | 
-| atime/noatime | POSIX standard Write/unwrite access date | atime | +| atime/noatime | POSIX | Do not use noatime feature, then the inode access time is controlled by kernel defaults/Do not update inode access times on this filesystem | atime | 
-| uid=value | Non-Linux formats Specifies file owner number for non-Linux file systems | root | +| uid=value | Non-Linux filesystems Set the owner of the root of the filesystem. | root | 
-| gid=value | Non-Linux Formats Specifies the owner group number | N/A | +| gid=value | Non-Linux filesystems Set the group of the root of the filesystem. | N/A | 
-| umask=value | Non-Linux Formats Specifies permissions (access/read/write rights) | N/A | +| umask=value | Non-Linux filesystems Set the umask. The default is the umask of the current process. The value is given in octal. | N/A | 
-| dmask=value | Non-Linux Formats Specifies folder usage rights (Obsolete, prefer dir_mode) | Current umask value +| dmask=value (Obsolete) | Non-Linux filesystems Set the umask applied to directories only. The value is given in octal. | Current processes' umask | 
-| dir_mode=value | Non-Linux Formats Specifies folder usage rights | Current umask value +| dir_mode=value (Replaces dmask)| Non-Linux filesystems Set the umask applied to directories only. The value is given in octal. | Current processes' umask | 
-| fmask=value | Non-Linux Formats Specifies file usage rights (Obsolete, prefer file_mode) | Current umask value +| fmask=value (Obsolete) | Non-Linux filesystems Set the umask applied to regular files only. The value is given in octal. | Current processes' umask | 
-| file_mode=value | Non-Linux Formats Specifies file usage rights | Current umask value |+| file_mode=value (Replaces fmask)| Non-Linux filesystems Set the umask applied to regular files only. The value is given in octal. | Current processes' umask |
  
 =====LAB #2 - Unix File System===== =====LAB #2 - Unix File System=====
  
-Each partition on a Unix system can host one of the following structures:+Each file system contains the following :
  
-  * superblock +  * Superblock 
-  * inodes +  * Inodes 
-  * data block +  * Data blocks 
-  * indirection blocks+  * Indirect blocks
  
 ====2.1 - Superblock==== ====2.1 - Superblock====
Ligne 252: Ligne 346:
 ====2.2 - Inodes==== ====2.2 - Inodes====
  
-Each file is represented by an **inode**. The inode contains :+Each file is represented by an **inode**. An inode contains the following information:
  
-  * 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 **rwx  rw-  r--**, 
-  * the number of physical links, i.e. the number of names +  * the number of hard links, 
-  * the creator's UID or the UID assigned by the **chown** command if there has been a modification +  * the UID of the file creator or the current UID attributed by the **chown** command, 
-  * the GID of the creator process or the GID assigned by the **chgrp** command +  * the GID of the creating process or the current GID attributed by the **chgrp** command, 
-  * 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 **atime**, 
-  * the addresses which point to the data blocks in the file.+  * allocation addresses that point to the data blocks used by the file.
  
 To understand this better, type the following command: To understand this better, type the following command:
Ligne 277: 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:
  
-  * **-** file +  * - - an ordinary file, 
-  * **d** - a directory +  * d - a directory, 
-  * **l** - a symbolic link +  * l - a symbolic link, 
-  * **b** - a block device +  * b - a bloc type peripheral, 
-  * **c** - a character device +  * c - a character type peripheral, 
-  * **p** - a named pipe for inter-process communication +  * p - a named pipe for communication between processes, 
-  * **s** - a socket in a network context+  * s - a network socket.
  
 To view the inode number, use the **-i** option: To view the inode number, use the **-i** option:
Ligne 297: 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 table**.+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 table**.
  
-The name of a file is not stored in the inode but in a **catalogue table**. This feature allows us to give two different names to the same file. To add a new name to a file, a **physical link** must be created.+The name of a file is not stored in the inode but in a **catalog table**. This feature allows us to give two different names to the same file. To add a new name to a file, a **physical link** must be created.
  
 ====2.4 - Physical (hard) links==== ====2.4 - Physical (hard) links====
Ligne 321: 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 a physical link :+Now create the hard link and check the result:
  
 <code> <code>
Ligne 350: Ligne 444:
   * ln -s filename shortcut_name   * ln -s filename shortcut_name
  
-To illustrate this point, type the following command line:+To illustrate this point, type the following command:
  
 <code> <code>
Ligne 366: Ligne 460:
  
 <WRAP center round important 60%> <WRAP center round important 60%>
-**Important**: A symbolic link can be created even if the two files are in two different filesystems and even if the source file does not exist.+**Important**: A symbolic link can be created even if the two files are in two different file systems and even if the source file does not exist.
 </WRAP> </WRAP>
  
 ----- -----
 Copyright © 2024 Hugh Norris. Copyright © 2024 Hugh Norris.
Menu