Différences
Ci-dessous, les différences entre deux révisions de la page.
Prochaine révision | Révision précédente | ||
elearning:workbooks:centos:8:admin:l118 [2021/10/27 15:50] – created admin | elearning:workbooks:centos:8:admin:l118 [2022/06/05 17:57] (Version actuelle) – admin | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
~~PDF: | ~~PDF: | ||
- | Version : **2021.01** | + | Version : **2022.01** |
- | Updated: ~~LASTMOD~~ | + | Last updated |
- | ======LCE601 | + | ======LCE512 |
=====Contents===== | =====Contents===== | ||
- | * **LCE601 | + | * **LCE512 |
* Contents | * Contents | ||
- | * Special Files | + | * The Linux Kernel |
- | * LAB #1 - Commands | + | * LAB #1 - Modules |
- | * 1.1 - The lspci Command | + | * LAB #2 - Compiling and Installing a Kernel and Modules |
- | * 1.2 - The lsusb Command | + | * 2.1 - Move /home |
- | * 1.3 - The dmidecode Command | + | * 2.2 - Preparing the Environment |
- | * LAB #2 - The sysctl Command | + | * 2.3 - Preparing the Kernel Source Tree |
- | * 2.1 - The /proc Directory | + | * The .config file |
- | * Files | + | * The Makefile file |
- | * / | + | * 2.4 - Configuring the Kernel |
- | * / | + | * 2.5 - Compiling the Kernel |
- | * /proc/dma | + | * 2.6 - Installing |
- | * / | + | * LAB #3 - Managing Quotas |
- | * / | + | * 3.1 - The quotacheck Command |
- | * / | + | * 3.2 - The edquota Command |
- | * / | + | * 3.3 - The quotaon Command |
- | * / | + | * 3.4 - The repquota Command |
- | * / | + | * 3.5 - The quota Command |
- | * / | + | * 3.6 - The warnquota |
- | * / | + | |
- | * / | + | |
- | * Directories | + | |
- | * ide/scsi | + | |
- | * acpi | + | |
- | * bus | + | |
- | * net | + | |
- | * sys | + | |
- | * 2.2 - Using the sysctl Command | + | |
- | * LAB #3 - Interpreting Information in /proc | + | |
- | * 3.1 - free | + | |
- | * 3.2 - uptime ou w | + | |
- | * 3.3 - iostat | + | |
- | * 3.4 - hdparm | + | |
- | * 3.5 - vmstat | + | |
- | * 3.6 - mpstat | + | |
- | * 3.7 - sar | + | |
- | * USB Modules | + | |
- | * udev | + | |
- | * The udevadm | + | |
- | * The /sys Filesystem | + | |
- | * LAB #4 - Limiting Ressources | + | |
- | * 4.1 - ulimit | + | |
- | =====Special Files===== | + | =====The Linux Kernel===== |
- | In a PC, peripherals are connected to a **controler** which communicates with the processor via a **bus**. The controller and associated | + | The Kernel is the part of the OS that is responsible for managing |
- | <WRAP center round important 60%> | + | * reducing the Kernel footprint, |
- | Peripherals that require the system to be halted prior to plugging or unplugging them are refered to as **Cold Plug Devices**. Peripherals that can be plugged/ | + | * supporting new peripherals, |
- | </ | + | |
- | + | | |
- | The following output shows the typical content of the /dev directory: | + | |
+ | | ||
+ | |||
+ | Start by updating CentOS 8: | ||
< | < | ||
- | [root@centos8 ~]# ls -l /dev | more | + | [root@centos8 ~]# dnf update |
- | total 0 | + | ... |
- | crw-r--r--. 1 root root 10, 235 Jun 28 02:04 autofs | + | [root@centos8 ~]# reboot |
- | drwxr-xr-x. 2 root root 180 Jun 28 02:04 block | + | |
- | drwxr-xr-x. 2 root root 100 Jun 28 02:04 bsg | + | |
- | drwxr-xr-x. | + | |
- | lrwxrwxrwx. | + | |
- | drwxr-xr-x. | + | |
- | drwxr-xr-x. | + | |
- | crw-------. | + | |
- | lrwxrwxrwx. | + | |
- | drwxr-xr-x. 10 root root 200 Jun 28 02:04 cpu | + | |
- | crw-------. | + | |
- | drwxr-xr-x. | + | |
- | brw-rw----. | + | |
- | brw-rw----. | + | |
- | drwxr-xr-x. | + | |
- | crw-rw----. | + | |
- | lrwxrwxrwx. | + | |
- | crw-rw-rw-. | + | |
- | crw-rw-rw-. | + | |
- | crw-------. | + | |
- | crw-------. | + | |
- | drwxr-xr-x. | + | |
- | crw-------. | + | |
- | lrwxrwxrwx. | + | |
- | drwxr-xr-x. | + | |
- | crw-r--r--. | + | |
- | lrwxrwxrwx. | + | |
- | crw-rw----. | + | |
- | crw-rw----. | + | |
- | crw-rw----. | + | |
- | crw-rw----. | + | |
- | crw-rw----. | + | |
- | drwxr-xr-x. | + | |
- | crw-------. | + | |
- | crw-r-----. | + | |
- | drwxrwxrwt. | + | |
- | drwxr-xr-x. | + | |
- | crw-rw-rw-. | + | |
- | --More-- | + | |
</ | </ | ||
- | As you can see, certain files refer to **block** devices whilst others refer to **character** devices: | + | Now identifiy the current Linux kernel: |
< | < | ||
- | ... | + | [root@centos8 ~]# uname -r |
- | brw-rw----. | + | 4.18.0-305.7.1.el8_4.x86_64 |
- | ... | + | |
- | crw-rw-rw-. 1 root tty | + | |
- | ... | + | |
</ | </ | ||
- | The major difference between these two types lies in the way that the communication between the system and the peripheral takes place. In the case of a block file, that communication uses a buffer whilst in the case of a character file the communication takes place directly byte by byte. | + | =====LAB #1 - Modules===== |
- | The figures that can be seen immediately before the date of the special file are called respectively | + | Under normal circumstances it is however preferable to make use of the Kernel modules as opposed to recompiling |
- | | + | < |
- | | + | [root@centos8 ~]# ls / |
+ | bls.conf | ||
+ | build modules.builtin.bin | ||
+ | config | ||
+ | kernel | ||
+ | modules.alias | ||
+ | modules.alias.bin | ||
+ | modules.block | ||
+ | </ | ||
- | =====LAB #1 - Commands===== | + | Commands |
- | ====1.1 - The lspci Command==== | + | * insmod |
+ | * rmmod | ||
+ | * lsmod | ||
+ | * modprobe | ||
- | This command show a list of the peripherals connected to the PCI, AGP and PCI express buses: | + | For example |
< | < | ||
- | [root@centos8 ~]# lspci | + | [root@centos8 ~]# lsmod |
- | 00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02) | + | Module |
- | 00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/ | + | xt_CHECKSUM |
- | 00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/ | + | ipt_MASQUERADE |
- | 00:01.2 USB controller: Intel Corporation 82371SB PIIX3 USB [Natoma/ | + | xt_conntrack |
- | 00:01.3 Bridge: Intel Corporation 82371AB/ | + | ipt_REJECT |
- | 00:02.0 VGA compatible controller: Device 1234:1111 (rev 02) | + | nft_compat |
- | 00:03.0 Unclassified device [00ff]: Red Hat, Inc. Virtio memory balloon | + | nf_nat_tftp |
- | 00:07.0 SATA controller: Intel Corporation 82801IR/ | + | nft_objref |
- | 00:12.0 Ethernet controller: Red Hat, Inc. Virtio network device | + | nf_conntrack_tftp |
- | 00:1e.0 PCI bridge: Red Hat, Inc. QEMU PCI-PCI bridge | + | nft_counter |
- | 00:1f.0 PCI bridge: Red Hat, Inc. QEMU PCI-PCI bridge | + | tun 53248 1 |
+ | bridge | ||
+ | stp 16384 1 bridge | ||
+ | llc 16384 2 bridge, | ||
+ | nft_fib_inet | ||
+ | nft_fib_ipv4 | ||
+ | nft_fib_ipv6 | ||
+ | nft_fib | ||
+ | nft_reject_inet | ||
+ | nf_reject_ipv4 | ||
+ | nf_reject_ipv6 | ||
+ | nft_reject | ||
+ | nft_ct | ||
+ | nf_tables_set | ||
+ | nft_chain_nat | ||
+ | nf_nat | ||
+ | nf_conntrack | ||
+ | nf_defrag_ipv6 | ||
+ | nf_defrag_ipv4 | ||
+ | ip_set | ||
+ | nf_tables | ||
+ | nfnetlink | ||
+ | sunrpc | ||
+ | ext4 761856 | ||
+ | mbcache | ||
+ | jbd2 131072 | ||
+ | virtio_balloon | ||
+ | pcspkr | ||
+ | i2c_piix4 | ||
+ | joydev | ||
+ | ip_tables | ||
+ | xfs 1515520 | ||
+ | libcrc32c | ||
+ | sr_mod | ||
+ | sd_mod | ||
+ | cdrom 65536 1 sr_mod | ||
+ | t10_pi | ||
+ | sg | ||
+ | ata_generic | ||
+ | bochs_drm | ||
+ | drm_vram_helper | ||
+ | drm_kms_helper | ||
+ | syscopyarea | ||
+ | sysfillrect | ||
+ | sysimgblt | ||
+ | fb_sys_fops | ||
+ | drm_ttm_helper | ||
+ | ttm | ||
+ | drm | ||
+ | ahci | ||
+ | libahci | ||
+ | virtio_net | ||
+ | net_failover | ||
+ | ata_piix | ||
+ | serio_raw | ||
+ | failover | ||
+ | libata | ||
+ | dm_mirror | ||
+ | dm_region_hash | ||
+ | dm_log | ||
+ | dm_mod | ||
+ | fuse 151552 | ||
</ | </ | ||
- | To obtain peripheral specific information, use the **-v** or **-vv** switches whilst specifying | + | To add a module, you can use either |
< | < | ||
- | [root@centos8 ~]# lspci -v -s 00:03.0 | + | [root@centos8 ~]# modprobe bonding |
- | 00:03.0 Unclassified device | + | [root@centos8 ~]# lsmod | more |
- | | + | Module |
- | | + | bonding |
- | | + | xt_CHECKSUM |
- | I/O ports at e000 [size=64] | + | ipt_MASQUERADE |
- | | + | xt_conntrack |
- | | + | ipt_REJECT |
- | | + | nft_compat |
- | | + | nf_nat_tftp |
- | | + | nft_objref |
- | | + | nf_conntrack_tftp |
- | | + | nft_counter |
+ | tun 53248 1 | ||
+ | bridge | ||
+ | stp 16384 1 bridge | ||
+ | llc 16384 2 bridge,stp | ||
+ | nft_fib_inet | ||
+ | nft_fib_ipv4 | ||
+ | nft_fib_ipv6 | ||
+ | nft_fib | ||
+ | nft_reject_inet | ||
+ | nf_reject_ipv4 | ||
+ | nf_reject_ipv6 | ||
+ | --More-- | ||
</ | </ | ||
+ | |||
+ | To delete a module, you can use either the **rmmod** command or the **modprobe -r** command. The latter also deletes any unused dependencies of the deleted module: | ||
< | < | ||
- | [root@centos8 ~]# lspci -vv -s 00:03.0 | + | [root@centos8 ~]# modprobe |
- | 00:03.0 Unclassified device | + | [root@centos8 ~]# lsmod | more |
- | | + | Module |
- | | + | xt_CHECKSUM |
- | | + | ipt_MASQUERADE |
- | | + | xt_conntrack |
- | | + | ipt_REJECT |
- | | + | nft_compat |
- | | + | nf_nat_tftp |
- | | + | nft_objref |
- | | + | nf_conntrack_tftp |
- | | + | nft_counter |
- | | + | tun 53248 1 |
- | BAR=4 offset=00003000 size=00001000 multiplier=00000004 | + | bridge |
- | | + | stp 16384 1 bridge |
- | BAR=4 offset=00002000 size=00001000 | + | llc 16384 2 bridge,stp |
- | | + | nft_fib_inet |
- | | + | nft_fib_ipv4 |
- | | + | nft_fib_ipv6 |
- | BAR=4 offset=00000000 size=00001000 | + | nft_fib |
- | | + | nft_reject_inet |
+ | nf_reject_ipv4 | ||
+ | nf_reject_ipv6 | ||
+ | nft_reject | ||
+ | --More-- | ||
</ | </ | ||
- | ===Command Line Switches=== | + | Module dependencies are resolved by the modprobe |
- | + | ||
- | The command | + | |
< | < | ||
- | [root@centos8 ~]# lspci --help | + | [root@centos8 ~]# more / |
- | lspci: invalid option | + | kernel/ |
- | Usage: lspci [< | + | kernel/ |
- | + | kernel/ | |
- | Basic display modes: | + | kernel/ |
- | -mm | + | kernel/ |
- | -t Show bus tree | + | kernel/ |
- | + | kernel/ | |
- | Display options: | + | kernel/ |
- | -v Be verbose (-vv or -vvv for higher verbosity) | + | kernel/ |
- | -k Show kernel | + | kernel/ |
- | -x Show hex-dump of the standard part of the config space | + | xz kernel/ |
- | -xxx Show hex-dump of the whole config space (dangerous; root only) | + | kernel/ |
- | -xxxx Show hex-dump of the 4096-byte extended config space (root only) | + | kernel/ |
- | -b Bus-centric view (addresses and IRQ's as seen by the bus) | + | kernel/ |
- | -D Always show domain numbers | + | kernel/ |
- | -P Display bridge path in addition to bus and device number | + | kernel/ |
- | -PP | + | kernel/ |
- | + | kernel/ | |
- | Resolving of device ID's to names: | + | kernel/ |
- | -n Show numeric ID's | + | kernel/ |
- | -nn Show both textual and numeric ID's (names & numbers) | + | _64.ko.xz |
- | -q Query the PCI ID database for unknown ID's via DNS | + | kernel/ |
- | -qq As above, but re-query locally cached entries | + | --More--(0%) |
- | -Q Query the PCI ID database for all ID's via DNS | + | |
- | + | ||
- | Selection of devices: | + | |
- | -s [[[[< | + | |
- | -d [< | + | |
- | + | ||
- | Other options: | + | |
- | -i < | + | |
- | -p < | + | |
- | -M Enable `bus | + | |
</ | </ | ||
- | ====1.2 - The lsusb Command==== | + | To see information about a specific module, use the **modinfo** command: |
- | + | ||
- | This command show a list of the peripherals connected to the USB bus: | + | |
< | < | ||
- | [root@centos8 ~]# lsusb | + | [root@centos8 ~]# modinfo bonding |
- | Bus 001 Device 002: ID 0627:0001 Adomax Technology Co., Ltd | + | filename: / |
- | Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub | + | author: |
- | + | description: | |
- | [root@centos8 ~]# lsusb -vt | + | license: GPL |
- | /: | + | alias: |
- | |__ Port 1: Dev 2, If 0, Class=Human Interface Device, Driver=usbhid, 12M | + | rhelversion: |
+ | srcversion: | ||
+ | depends: | ||
+ | intree: | ||
+ | name: | ||
+ | vermagic: | ||
+ | sig_id: | ||
+ | signer: | ||
+ | sig_key: | ||
+ | sig_hashalgo: | ||
+ | signature: | ||
+ | B7: | ||
+ | 3F: | ||
+ | BE: | ||
+ | 44: | ||
+ | DE: | ||
+ | 7F: | ||
+ | D8: | ||
+ | BA: | ||
+ | B8: | ||
+ | 8F: | ||
+ | 58: | ||
+ | 6E: | ||
+ | 50: | ||
+ | 2F: | ||
+ | CA: | ||
+ | 0C: | ||
+ | A6: | ||
+ | AE: | ||
+ | 59: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: lacp_rate: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: fail_over_mac: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
</ | </ | ||
- | ===Command Line Switches=== | + | Finally, files in the **/ |
- | The command line switches of this command are: | + | < |
+ | [root@centos8 ~]# ls / | ||
+ | firewalld-sysctls.conf | ||
+ | kvm.conf | ||
- | < | + | [root@centos8 ~]# cat / |
- | [root@centos8 ~]# lsusb --help | + | # Setting modprobe kvm_intel/ |
- | Usage: lsusb [options]... | + | # only enables Nested Virtualization until the next reboot |
- | List USB devices | + | # module reload. Uncomment the option applicable |
- | -v, --verbose | + | # to your system below to enable the feature permanently. |
- | Increase verbosity (show descriptors) | + | # |
- | -s [[bus]: | + | # User changes |
- | Show only devices with specified device and/or | + | # |
- | bus numbers (in decimal) | + | # For Intel |
- | -d vendor: | + | #options kvm_intel nested=1 |
- | Show only devices with the specified vendor and | + | # |
- | | + | # For AMD |
- | .LAB#1 | + | #options kvm_amd nested=1 |
- | -D device | + | |
- | | + | |
- | -t, --tree | + | |
- | Dump the physical USB device hierarchy as a tree | + | |
- | -V, --version | + | |
- | Show version of program | + | |
- | -h, --help | + | |
- | Show usage and help | + | |
</ | </ | ||
- | ====1.3 - The dmidecode Command==== | + | =====LAB #2 - Compiling and Installing a Kernel and Modules===== |
- | The **dmidecode** Command reads the **DMI** (//Desktop Management Interface// | + | Firstly, activate the **CentOS-Linux-PowerTools** repository by setting |
- | + | ||
- | * the current status of each peripheral, | + | |
- | * possible extensions. | + | |
< | < | ||
- | [root@centos8 ~]# dmidecode | + | [root@centos8 ~]# vi / |
- | # dmidecode 3.2 | + | [root@centos8 ~]# cat /etc/yum.repos.d/ |
- | Getting SMBIOS data from sysfs. | + | # CentOS-Linux-PowerTools.repo |
- | SMBIOS 2.8 present. | + | # |
- | 11 structures occupying 511 bytes. | + | # The mirrorlist system uses the connecting IP address of the client and the |
- | Table at 0x000F5870. | + | # update status of each mirror to pick current mirrors that are geographically |
+ | # close to the client. You should use this for CentOS updates unless you are | ||
+ | # manually picking other mirrors. | ||
+ | # | ||
+ | # If the mirrorlist does not work for you, you can try the commented out | ||
+ | # baseurl line instead. | ||
- | Handle 0x0000, DMI type 0, 24 bytes | + | [powertools] |
- | BIOS Information | + | name=CentOS Linux $releasever - PowerTools |
- | | + | mirrorlist=http:// |
- | Version: rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org | + | # |
- | | + | gpgcheck=1 |
- | Address: 0xE8000 | + | enabled=1 |
- | Runtime Size: 96 kB | + | gpgkey=file:/// |
- | ROM Size: 64 kB | + | |
- | Characteristics: | + | |
- | BIOS characteristics not supported | + | |
- | Targeted content distribution is supported | + | |
- | BIOS Revision: 0.0 | + | |
- | + | ||
- | Handle 0x0100, DMI type 1, 27 bytes | + | |
- | System Information | + | |
- | Manufacturer: | + | |
- | Product Name: Standard PC (i440FX + PIIX, 1996) | + | |
- | Version: pc-i440fx-5.2 | + | |
- | | + | |
- | UUID: 95bd69e3-4a74-44a7-b58c-b74fbfb86df2 | + | |
- | Wake-up Type: Power Switch | + | |
- | SKU Number: Not Specified | + | |
- | Family: Not Specified | + | |
- | + | ||
- | Handle 0x0300, DMI type 3, 22 bytes | + | |
- | Chassis Information | + | |
- | Manufacturer: | + | |
- | Type: Other | + | |
- | Lock: Not Present | + | |
- | Version: pc-i440fx-5.2 | + | |
- | Serial Number: Not Specified | + | |
- | Asset Tag: Not Specified | + | |
- | Boot-up State: Safe | + | |
- | Power Supply State: Safe | + | |
- | Thermal State: Safe | + | |
- | Security Status: Unknown | + | |
- | OEM Information: | + | |
- | Height: Unspecified | + | |
- | Number Of Power Cords: Unspecified | + | |
- | Contained Elements: 0 | + | |
- | SKU Number: Not Specified | + | |
- | + | ||
- | Handle 0x0400, DMI type 4, 42 bytes | + | |
- | Processor Information | + | |
- | Socket Designation: | + | |
- | Type: Central Processor | + | |
- | Family: Other | + | |
- | Manufacturer: | + | |
- | ID: 61 0F 00 00 FF FB 8B 07 | + | |
- | Version: pc-i440fx-5.2 | + | |
- | Voltage: Unknown | + | |
- | External Clock: Unknown | + | |
- | Max Speed: 2000 MHz | + | |
- | Current Speed: 2000 MHz | + | |
- | Status: Populated, Enabled | + | |
- | Upgrade: Other | + | |
- | L1 Cache Handle: Not Provided | + | |
- | L2 Cache Handle: Not Provided | + | |
- | L3 Cache Handle: Not Provided | + | |
- | Serial Number: Not Specified | + | |
- | Asset Tag: Not Specified | + | |
- | Part Number: Not Specified | + | |
- | Core Count: 4 | + | |
- | Core Enabled: 4 | + | |
- | Thread Count: | + | |
- | | + | |
- | + | ||
- | Handle 0x0401, DMI type 4, 42 bytes | + | |
- | Processor Information | + | |
- | Socket Designation: | + | |
- | Type: Central Processor | + | |
- | Family: Other | + | |
- | Manufacturer: | + | |
- | ID: 61 0F 00 00 FF FB 8B 07 | + | |
- | Version: pc-i440fx-5.2 | + | |
- | Voltage: Unknown | + | |
- | External Clock: Unknown | + | |
- | Max Speed: 2000 MHz | + | |
- | Current Speed: 2000 MHz | + | |
- | Status: Populated, Enabled | + | |
- | Upgrade: Other | + | |
- | L1 Cache Handle: Not Provided | + | |
- | L2 Cache Handle: Not Provided | + | |
- | L3 Cache Handle: Not Provided | + | |
- | Serial Number: Not Specified | + | |
- | Asset Tag: Not Specified | + | |
- | Part Number: Not Specified | + | |
- | Core Count: 4 | + | |
- | Core Enabled: 4 | + | |
- | Thread Count: 1 | + | |
- | Characteristics: | + | |
- | + | ||
- | Handle 0x1000, DMI type 16, 23 bytes | + | |
- | Physical Memory Array | + | |
- | Location: Other | + | |
- | Use: System Memory | + | |
- | Error Correction Type: Multi-bit ECC | + | |
- | Maximum Capacity: 4 GB | + | |
- | Error Information Handle: Not Provided | + | |
- | Number Of Devices: 1 | + | |
- | + | ||
- | Handle 0x1100, DMI type 17, 40 bytes | + | |
- | Memory Device | + | |
- | Array Handle: 0x1000 | + | |
- | Error Information Handle: Not Provided | + | |
- | Total Width: Unknown | + | |
- | Data Width: Unknown | + | |
- | Size: 4 GB | + | |
- | Form Factor: DIMM | + | |
- | Set: None | + | |
- | Locator: DIMM 0 | + | |
- | Bank Locator: Not Specified | + | |
- | Type: RAM | + | |
- | Type Detail: Other | + | |
- | Speed: Unknown | + | |
- | Manufacturer: | + | |
- | Serial Number: Not Specified | + | |
- | Asset Tag: Not Specified | + | |
- | Part Number: Not Specified | + | |
- | Rank: Unknown | + | |
- | Configured Memory Speed: Unknown | + | |
- | Minimum Voltage: Unknown | + | |
- | Maximum Voltage: Unknown | + | |
- | Configured Voltage: Unknown | + | |
- | + | ||
- | Handle 0x1300, DMI type 19, 31 bytes | + | |
- | Memory Array Mapped Address | + | |
- | Starting Address: 0x00000000000 | + | |
- | Ending Address: 0x000BFFFFFFF | + | |
- | Range Size: 3 GB | + | |
- | Physical Array Handle: 0x1000 | + | |
- | Partition Width: 1 | + | |
- | + | ||
- | Handle 0x1301, DMI type 19, 31 bytes | + | |
- | Memory Array Mapped Address | + | |
- | Starting Address: 0x00100000000 | + | |
- | Ending Address: 0x0013FFFFFFF | + | |
- | Range Size: 1 GB | + | |
- | Physical Array Handle: 0x1000 | + | |
- | Partition Width: 1 | + | |
- | + | ||
- | Handle 0x2000, DMI type 32, 11 bytes | + | |
- | System Boot Information | + | |
- | Status: No errors detected | + | |
- | + | ||
- | Handle 0x7F00, DMI type 127, 4 bytes | + | |
- | End Of Table | + | |
</ | </ | ||
- | ===Command Line Switches=== | + | Now install the package group " |
- | + | ||
- | The command line switches of this command are: | + | |
< | < | ||
- | [root@centos7 | + | [root@centos8 |
- | Usage: dmidecode | + | ... |
- | Options are: | + | [root@centos8 ~]# dnf install asciidoc audit-libs-devel bash bc binutils binutils-devel bison diffutils elfutils elfutils-devel elfutils-libelf-devel findutils flex gawk gcc gettext gzip hmaccalc hostname make module-init-tools ncurses-devel net-tools newt-devel numactl-devel openssl patch pciutils-devel perl perl-ExtUtils-Embed pesign redhat-rpm-config rpm-build rpmdevtools sh-utils tar xmlto xz zlib-devel |
- | -d, --dev-mem FILE Read memory from device FILE (default: /dev/mem) | + | ... |
- | -h, --help | + | |
- | -q, --quiet Less verbose output | + | |
- | -s, --string KEYWORD | + | |
- | -t, --type TYPE Only display the entries of given type | + | |
- | -u, --dump Do not decode the entries | + | |
- | --dump-bin FILE Dump the DMI data to a binary file | + | |
- | --from-dump FILE Read the DMI data from a binary file | + | |
- | -V, --version | + | |
</ | </ | ||
- | =====LAB #2 - The sysctl Command===== | + | ====2.1 - Move /home==== |
- | ====2.1 | + | <WRAP center round alert 60%> |
+ | **Important** | ||
+ | </WRAP> | ||
- | The /proc directory contains virtual files and directories wich are created dynamically when consulted. Only root can consult all of the information in /proc. | + | <WRAP center round todo 60%> |
- | + | **To do** - **Log out** of your **CentOS8_SSH_10.0.2.45** session and open a new session using the **CentOS8_ROOT_10.0.2.45** connection. | |
- | <code> | + | </WRAP> |
- | [root@centos8 ~]# ls /proc | + | |
- | 1 16391 19 2212 2427 2622 431 | + | |
- | 10 | + | |
- | 1007 | + | |
- | 11 | + | |
- | 11805 16593 | + | |
- | 12 | + | |
- | 1219 | + | |
- | 1228 | + | |
- | 1232 | + | |
- | 1234 | + | |
- | 1235 | + | |
- | 1247 | + | |
- | 13 | + | |
- | 1307 | + | |
- | 1339 | + | |
- | 1356 | + | |
- | 14 | + | |
- | 1441 | + | |
- | 1443 | + | |
- | 1444 | + | |
- | 1446 | + | |
- | 14977 1828 | + | |
- | 15 | + | |
- | 15067 183 2167 2330 2571 422 | + | |
- | 1536 | + | |
- | 1553 | + | |
- | 15594 186 2187 2358 259 | + | |
- | 15735 187 2190 2373 2593 427 | + | |
- | 16 | + | |
- | 16165 1883 | + | |
- | 16167 1888 | + | |
- | </code> | + | |
- | + | ||
- | ===Files=== | + | |
- | ==/proc/cpuinfo== | + | Create a partition on **/dev/sdc** : |
< | < | ||
- | [root@centos8 ~]# cat /proc/cpuinfo | + | [root@centos8 ~]# fdisk /dev/sdc |
- | processor | + | |
- | vendor_id | + | |
- | cpu family | + | |
- | model : 6 | + | |
- | model name : Common KVM processor | + | |
- | stepping | + | |
- | microcode | + | |
- | cpu MHz : 1999.987 | + | |
- | cache size : 16384 KB | + | |
- | physical id : 0 | + | |
- | siblings | + | |
- | core id : 0 | + | |
- | cpu cores : 4 | + | |
- | apicid | + | |
- | initial apicid | + | |
- | fpu : yes | + | |
- | fpu_exception | + | |
- | cpuid level : 13 | + | |
- | wp : yes | + | |
- | flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx lm constant_tsc nopl xtopology cpuid tsc_known_freq pni cx16 x2apic hypervisor lahf_lm cpuid_fault pti | + | |
- | bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit | + | |
- | bogomips | + | |
- | clflush size : 64 | + | |
- | cache_alignment : 128 | + | |
- | address sizes : 40 bits physical, 48 bits virtual | + | |
- | power management: | + | |
- | processor | + | Welcome to fdisk (util-linux 2.32.1). |
- | vendor_id | + | Changes will remain in memory only, until you decide to write them. |
- | cpu family | + | Be careful before using the write command. |
- | model : 6 | + | |
- | model name : Common KVM processor | + | |
- | stepping | + | |
- | microcode | + | |
- | cpu MHz : 1999.987 | + | |
- | cache size : 16384 KB | + | |
- | physical id : 0 | + | |
- | siblings | + | |
- | core id : | + | |
- | cpu cores : 4 | + | |
- | apicid | + | |
- | initial apicid | + | |
- | fpu : yes | + | |
- | fpu_exception | + | |
- | cpuid level : 13 | + | |
- | wp : yes | + | |
- | flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx lm constant_tsc nopl xtopology cpuid tsc_known_freq pni cx16 x2apic hypervisor lahf_lm cpuid_fault pti | + | |
- | bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit | + | |
- | bogomips | + | |
- | clflush size : 64 | + | |
- | cache_alignment : 128 | + | |
- | address sizes : 40 bits physical, 48 bits virtual | + | |
- | power management: | + | |
- | processor | + | Device does not contain a recognized partition table. |
- | vendor_id | + | Created a new DOS disklabel with disk identifier 0xc321702b. |
- | cpu family | + | |
- | model : 6 | + | |
- | model name : Common KVM processor | + | |
- | stepping | + | |
- | microcode | + | |
- | cpu MHz : 1999.987 | + | |
- | cache size : 16384 KB | + | |
- | physical id : 0 | + | |
- | siblings | + | |
- | core id : 2 | + | |
- | cpu cores : 4 | + | |
- | apicid | + | |
- | initial apicid | + | |
- | fpu : yes | + | |
- | fpu_exception | + | |
- | cpuid level : 13 | + | |
- | wp : yes | + | |
- | flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx lm constant_tsc nopl xtopology cpuid tsc_known_freq pni cx16 x2apic hypervisor lahf_lm cpuid_fault pti | + | |
- | bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit | + | |
- | bogomips | + | |
- | clflush size : 64 | + | |
- | cache_alignment : 128 | + | |
- | address sizes : 40 bits physical, 48 bits virtual | + | |
- | power management: | + | |
- | processor | + | Command (m for help): n |
- | vendor_id | + | Partition type |
- | cpu family | + | p |
- | model : 6 | + | e |
- | model name : Common KVM processor | + | Select (default p): |
- | stepping | + | |
- | microcode | + | |
- | cpu MHz : 1999.987 | + | |
- | cache size : 16384 KB | + | |
- | physical id : | + | |
- | siblings | + | |
- | core id : 3 | + | |
- | cpu cores : 4 | + | |
- | apicid | + | |
- | initial apicid | + | |
- | fpu : yes | + | |
- | fpu_exception | + | |
- | cpuid level : 13 | + | |
- | wp : yes | + | |
- | flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx lm constant_tsc nopl xtopology cpuid tsc_known_freq pni cx16 x2apic hypervisor lahf_lm cpuid_fault pti | + | |
- | bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit | + | |
- | bogomips | + | |
- | clflush size : 64 | + | |
- | cache_alignment : 128 | + | |
- | address sizes | + | |
- | power management: | + | |
- | processor | + | Using default response p. |
- | vendor_id | + | Partition number (1-4, default 1): |
- | cpu family | + | First sector (2048-41943039, |
- | model : 6 | + | Last sector, +sectors or +size{K,M,G,T,P} (2048-41943039, |
- | model name : Common KVM processor | + | |
- | stepping | + | |
- | microcode | + | |
- | cpu MHz : 1999.987 | + | |
- | cache size : 16384 KB | + | |
- | physical id : | + | |
- | siblings | + | |
- | core id : 0 | + | |
- | cpu cores : 4 | + | |
- | apicid | + | |
- | initial apicid | + | |
- | fpu : yes | + | |
- | fpu_exception | + | |
- | cpuid level : 13 | + | |
- | wp : yes | + | |
- | flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx lm constant_tsc nopl xtopology cpuid tsc_known_freq pni cx16 x2apic hypervisor lahf_lm cpuid_fault pti | + | |
- | bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit | + | |
- | bogomips | + | |
- | clflush | + | |
- | cache_alignment : 128 | + | |
- | address sizes : 40 bits physical, 48 bits virtual | + | |
- | power management: | + | |
- | processor | + | Created a new partition |
- | vendor_id | + | |
- | cpu family | + | |
- | model : 6 | + | |
- | model name : Common KVM processor | + | |
- | stepping | + | |
- | microcode | + | |
- | cpu MHz : 1999.987 | + | |
- | cache size : 16384 KB | + | |
- | physical id : 1 | + | |
- | siblings | + | |
- | core id : 1 | + | |
- | cpu cores : 4 | + | |
- | apicid | + | |
- | initial apicid | + | |
- | fpu : yes | + | |
- | fpu_exception | + | |
- | cpuid level : 13 | + | |
- | wp : yes | + | |
- | flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx lm constant_tsc nopl xtopology cpuid tsc_known_freq pni cx16 x2apic hypervisor lahf_lm cpuid_fault pti | + | |
- | bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit | + | |
- | bogomips | + | |
- | clflush size : 64 | + | |
- | cache_alignment : 128 | + | |
- | address sizes : 40 bits physical, 48 bits virtual | + | |
- | power management: | + | |
- | processor | + | Command (m for help): w |
- | vendor_id | + | The partition table has been altered. |
- | cpu family | + | Calling ioctl() to re-read partition table. |
- | model : 6 | + | Syncing disks. |
- | model name : Common KVM processor | + | |
- | stepping | + | |
- | microcode | + | |
- | cpu MHz : 1999.987 | + | |
- | cache size : 16384 KB | + | |
- | physical id : 1 | + | |
- | siblings | + | |
- | core id : 2 | + | |
- | cpu cores : 4 | + | |
- | apicid | + | |
- | initial apicid | + | |
- | fpu : yes | + | |
- | fpu_exception | + | |
- | cpuid level : 13 | + | |
- | wp : yes | + | |
- | flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx lm constant_tsc nopl xtopology cpuid tsc_known_freq pni cx16 x2apic hypervisor lahf_lm cpuid_fault pti | + | |
- | bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit | + | |
- | bogomips | + | |
- | clflush size : 64 | + | |
- | cache_alignment : 128 | + | |
- | address sizes : 40 bits physical, 48 bits virtual | + | |
- | power management: | + | |
- | + | ||
- | processor | + | |
- | vendor_id | + | |
- | cpu family | + | |
- | model : 6 | + | |
- | model name : Common KVM processor | + | |
- | stepping | + | |
- | microcode | + | |
- | cpu MHz : 1999.987 | + | |
- | cache size : 16384 KB | + | |
- | physical id : 1 | + | |
- | siblings | + | |
- | core id : 3 | + | |
- | cpu cores : 4 | + | |
- | apicid | + | |
- | initial apicid | + | |
- | fpu : yes | + | |
- | fpu_exception | + | |
- | cpuid level : 13 | + | |
- | wp : yes | + | |
- | flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx lm constant_tsc nopl xtopology cpuid tsc_known_freq pni cx16 x2apic hypervisor lahf_lm cpuid_fault pti | + | |
- | bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit | + | |
- | bogomips | + | |
- | clflush size : 64 | + | |
- | cache_alignment : 128 | + | |
- | address sizes : 40 bits physical, 48 bits virtual | + | |
- | power management: | + | |
</ | </ | ||
- | ==/proc/interrupts== | + | Now create an ext4 filesystem on **/dev/sdc1** : |
< | < | ||
- | [root@centos8 ~]# cat /proc/interrupts | + | [root@centos8 ~]# mkfs.ext4 |
- | CPU0 | + | mke2fs |
- | 0: 109 0 0 0 0 0 0 0 | + | Discarding device blocks: done |
- | | + | Creating filesystem with 16776960 4k blocks and 4194304 inodes |
- | 8: | + | Filesystem UUID: dc92c0d7-919b-4fff-8719-53e9e7e628dd |
- | | + | Superblock backups stored on blocks: |
- | 10: | + | |
- | | + | |
- | 12: | + | |
- | 14: 0 0 0 0 0 0 0 0 | + | |
- | | + | |
- | | + | |
- | 25: 0 0 0 0 0 | + | |
- | | + | |
- | | + | |
- | NMI: 0 0 0 0 0 0 0 0 | + | |
- | LOC: | + | |
- | SPU: 0 0 0 0 0 0 0 0 | + | |
- | PMI: 0 0 0 0 0 0 0 0 | + | |
- | IWI: 0 0 0 0 2 0 0 0 IRQ work interrupts | + | |
- | RTR: 0 0 0 0 0 0 0 0 APIC ICR read retries | + | |
- | RES: | + | |
- | CAL: 11095 11007 10841 10343 14679 | + | |
- | TLB: | + | |
- | TRM: 0 0 0 0 0 0 0 0 | + | |
- | THR: 0 0 0 0 0 0 0 0 | + | |
- | DFR: 0 0 0 0 0 0 0 0 | + | |
- | MCE: 0 0 0 0 0 0 0 0 | + | |
- | MCP: 288 288 288 288 288 288 288 288 | + | |
- | HYP: 0 0 0 0 0 0 0 0 | + | |
- | HRE: 0 0 0 0 0 0 0 0 | + | |
- | HVS: 0 0 0 0 0 0 0 0 | + | |
- | ERR: 0 | + | |
- | MIS: 0 | + | |
- | PIN: 0 0 0 0 0 0 0 0 | + | |
- | NPI: 0 0 0 0 0 0 0 0 | + | |
- | PIW: 0 0 0 0 0 0 0 0 | + | |
- | </ | + | |
- | <WRAP center round important 60%> | + | Allocating group tables: done |
- | **Important** | + | Writing inode tables: done |
- | </ | + | Creating journal (65536 blocks): done |
- | + | Writing superblocks and filesystem accounting information: done | |
- | ==/ | + | |
- | + | ||
- | < | + | |
- | [root@centos8 ~]# cat /proc/dma | + | |
- | 4: cascade | + | |
</ | </ | ||
- | ==/proc/ioports== | + | Mount **/dev/sdc1** on /mnt : |
< | < | ||
- | root@centos8 ~]# cat /proc/ioports | more | + | [root@centos8 ~]# mount /dev/sdc1 /mnt |
- | 0000-0cf7 : PCI Bus 0000:00 | + | |
- | 0000-001f : dma1 | + | |
- | 0020-0021 : pic1 | + | |
- | 0040-0043 : timer0 | + | |
- | 0050-0053 : timer1 | + | |
- | 0060-0060 : keyboard | + | |
- | 0064-0064 : keyboard | + | |
- | 0070-0077 : rtc0 | + | |
- | 0080-008f : dma page reg | + | |
- | 00a0-00a1 : pic2 | + | |
- | 00c0-00df : dma2 | + | |
- | 00f0-00ff : fpu | + | |
- | 0170-0177 : 0000: | + | |
- | 0170-0177 : ata_piix | + | |
- | 01f0-01f7 : 0000: | + | |
- | 01f0-01f7 : ata_piix | + | |
- | 0376-0376 : 0000: | + | |
- | 0376-0376 : ata_piix | + | |
- | 03c0-03df : vga+ | + | |
- | 03f6-03f6 : 0000: | + | |
- | 03f6-03f6 : ata_piix | + | |
- | --More-- | + | |
</ | </ | ||
- | <WRAP center round alert 60%> | + | Copy the content of /home to /mnt : |
- | **Important** - If two peripherals use the same IO Port, both become unusable. | + | |
- | </WRAP> | + | |
- | + | ||
- | ==/proc/ | + | |
< | < | ||
- | [root@centos8 ~]# cat /proc/devices | + | [root@centos8 ~]# cp -a /home/* /mnt |
- | Character devices: | + | |
- | 1 mem | + | |
- | 4 /dev/vc/0 | + | |
- | 4 tty | + | |
- | 4 ttyS | + | |
- | 5 /dev/tty | + | |
- | 5 / | + | |
- | 5 /dev/ptmx | + | |
- | 7 vcs | + | |
- | 10 misc | + | |
- | 13 input | + | |
- | 21 sg | + | |
- | 29 fb | + | |
- | 128 ptm | + | |
- | 136 pts | + | |
- | 162 raw | + | |
- | 180 usb | + | |
- | 188 ttyUSB | + | |
- | 189 usb_device | + | |
- | 202 cpu/msr | + | |
- | 203 cpu/cpuid | + | |
- | 226 drm | + | |
- | 244 aux | + | |
- | 245 hidraw | + | |
- | 246 usbmon | + | |
- | 247 bsg | + | |
- | 248 watchdog | + | |
- | 249 ptp | + | |
- | 250 pps | + | |
- | 251 rtc | + | |
- | 252 dax | + | |
- | 253 tpm | + | |
- | 254 gpiochip | + | |
- | + | ||
- | Block devices: | + | |
- | 8 sd | + | |
- | 9 md | + | |
- | 11 sr | + | |
- | 65 sd | + | |
- | 66 sd | + | |
- | 67 sd | + | |
- | 68 sd | + | |
- | 69 sd | + | |
- | 70 sd | + | |
- | 71 sd | + | |
- | 128 sd | + | |
- | 129 sd | + | |
- | 130 sd | + | |
- | 131 sd | + | |
- | 132 sd | + | |
- | 133 sd | + | |
- | 134 sd | + | |
- | 135 sd | + | |
- | 253 device-mapper | + | |
- | 254 mdp | + | |
- | 259 blkext | + | |
</ | </ | ||
- | ==/proc/modules== | + | Unmount |
< | < | ||
- | [root@centos8 ~]# cat /proc/modules | more | + | [root@centos8 ~]# umount |
- | xt_CHECKSUM 16384 1 - Live 0xffffffffc09a8000 | + | [root@centos8 ~]# mv /home /root |
- | ipt_MASQUERADE 16384 3 - Live 0xffffffffc09a3000 | + | |
- | xt_conntrack 16384 1 - Live 0xffffffffc099e000 | + | |
- | ipt_REJECT 16384 2 - Live 0xffffffffc0999000 | + | |
- | nft_compat 20480 16 - Live 0xffffffffc0993000 | + | |
- | nf_nat_tftp 16384 0 - Live 0xffffffffc098b000 | + | |
- | nft_objref 16384 1 - Live 0xffffffffc0986000 | + | |
- | nf_conntrack_tftp 16384 3 nf_nat_tftp, | + | |
- | nft_counter 16384 33 - Live 0xffffffffc097c000 | + | |
- | tun 53248 1 - Live 0xffffffffc096e000 | + | |
- | bridge 192512 0 - Live 0xffffffffc093e000 | + | |
- | stp 16384 1 bridge, Live 0xffffffffc0939000 | + | |
- | llc 16384 2 bridge,stp, Live 0xffffffffc0930000 | + | |
- | nft_fib_inet 16384 1 - Live 0xffffffffc08f5000 | + | |
- | nft_fib_ipv4 16384 1 nft_fib_inet, | + | |
- | nft_fib_ipv6 16384 1 nft_fib_inet, | + | |
- | nft_fib 16384 3 nft_fib_inet, | + | |
- | nft_reject_inet 16384 5 - Live 0xffffffffc08de000 | + | |
- | nf_reject_ipv4 16384 2 ipt_REJECT, | + | |
- | nf_reject_ipv6 16384 1 nft_reject_inet, | + | |
- | nft_reject 16384 1 nft_reject_inet, | + | |
- | --More-- | + | |
</ | </ | ||
- | ==/proc/diskstats== | + | Get the UUID of /dev/sdc1 : |
< | < | ||
- | [root@centos8 ~]# cat /proc/diskstats | + | [root@centos8 ~]# ls -l /dev/disk/ |
- | | + | lrwxrwxrwx. |
- | 8 1 sda1 402 3 66754 13349 31 18 392 4632 0 2824 17981 0 0 0 0 | + | [root@centos8 ~]# |
- | | + | |
- | | + | |
- | 11 0 sr0 10 0 4 2 0 0 0 0 0 9 2 0 0 0 0 | + | |
- | | + | |
- | | + | |
</ | </ | ||
- | ==/proc/partitions== | + | Edit the **/etc/fstab** file add a line for /dev/sdc1: |
< | < | ||
- | [root@centos8 ~]# cat /proc/partitions | + | [root@centos8 ~]# vi /etc/fstab |
- | major minor | + | [root@centos8 ~]# cat /etc/fstab |
- | | + | # |
- | 8 1 1048576 sda1 | + | # /etc/fstab |
- | 8 2 | + | # Created by anaconda on Wed Jun 16 06:21:32 2021 |
- | | + | # |
- | | + | # Accessible filesystems, |
- | 253 | + | # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info. |
- | 253 | + | # |
+ | # After editing this file, run ' | ||
+ | # units generated from this file. | ||
+ | # | ||
+ | / | ||
+ | UUID=1c04981e-5317-4b73-9695-3ce25246835d /boot | ||
+ | / | ||
+ | UUID=f76d6b66-985b-4a91-af9c-4987e8c1443c /home | ||
</ | </ | ||
- | ==/proc/ | + | Create a new mount point foe /home: |
< | < | ||
- | [root@centos8 ~]# cat /proc/ | + | [root@centos8 ~]# mkdir /home |
- | Filename | + | |
- | / | + | |
</ | </ | ||
- | ==/proc/loadavg== | + | Mount /dev/sdc1 : |
< | < | ||
- | [root@centos8 ~]# cat /proc/loadavg | + | [root@centos8 ~]# mount -a |
- | 0.00 0.00 0.00 1/697 16936 | + | [root@centos8 ~]# mount |
+ | sysfs on /sys type sysfs (rw, | ||
+ | proc on /proc type proc (rw, | ||
+ | devtmpfs on /dev type devtmpfs (rw, | ||
+ | securityfs on / | ||
+ | tmpfs on /dev/shm type tmpfs (rw, | ||
+ | devpts on /dev/pts type devpts (rw, | ||
+ | tmpfs on /run type tmpfs (rw, | ||
+ | tmpfs on / | ||
+ | cgroup on / | ||
+ | pstore on / | ||
+ | bpf on /sys/fs/bpf type bpf (rw, | ||
+ | cgroup on / | ||
+ | cgroup on / | ||
+ | cgroup on / | ||
+ | cgroup on / | ||
+ | cgroup on / | ||
+ | cgroup on / | ||
+ | cgroup on / | ||
+ | cgroup on / | ||
+ | cgroup on / | ||
+ | cgroup on / | ||
+ | cgroup on / | ||
+ | none on / | ||
+ | configfs on / | ||
+ | / | ||
+ | selinuxfs on / | ||
+ | mqueue on /dev/mqueue type mqueue (rw, | ||
+ | hugetlbfs on / | ||
+ | debugfs on / | ||
+ | systemd-1 on / | ||
+ | fusectl on / | ||
+ | /dev/sda1 on /boot type ext4 (rw, | ||
+ | sunrpc on / | ||
+ | tmpfs on / | ||
+ | tmpfs on / | ||
+ | gvfsd-fuse on / | ||
+ | tmpfs on /run/user/0 type tmpfs (rw, | ||
+ | gvfsd-fuse on /run/user/0/gvfs type fuse.gvfsd-fuse (rw, | ||
+ | /dev/sdc1 on /home type ext4 (rw, | ||
</ | </ | ||
- | ==/proc/ | + | Check the current size of /home : |
< | < | ||
- | [root@centos8 ~]# cat / | + | [root@centos8 ~]# df -h |
- | MemTotal: | + | Filesystem |
- | MemFree: | + | devtmpfs |
- | MemAvailable: | + | tmpfs 1.9G |
- | Buffers: | + | tmpfs 1.9G 9.4M 1.9G |
- | Cached: | + | tmpfs 1.9G 0 |
- | SwapCached: | + | / |
- | Active: | + | / |
- | Inactive: | + | tmpfs 374M |
- | Active(anon): | + | tmpfs 374M 1.2M 373M 1% / |
- | Inactive(anon): | + | / |
- | Active(file): | + | |
- | Inactive(file): | + | |
- | Unevictable: | + | |
- | Mlocked: | + | |
- | SwapTotal: | + | |
- | SwapFree: | + | |
- | Dirty: | + | |
- | Writeback: | + | |
- | AnonPages: | + | |
- | Mapped: | + | |
- | Shmem: | + | |
- | KReclaimable: | + | |
- | Slab: | + | |
- | SReclaimable: | + | |
- | SUnreclaim: | + | |
- | KernelStack: | + | |
- | PageTables: | + | |
- | NFS_Unstable: | + | |
- | Bounce: | + | |
- | WritebackTmp: | + | |
- | CommitLimit: | + | |
- | Committed_AS: | + | |
- | VmallocTotal: | + | |
- | VmallocUsed: | + | |
- | VmallocChunk: | + | |
- | Percpu: | + | |
- | HardwareCorrupted: | + | |
- | AnonHugePages: | + | |
- | ShmemHugePages: | + | |
- | ShmemPmdMapped: | + | |
- | FileHugePages: | + | |
- | FilePmdMapped: | + | |
- | HugePages_Total: | + | |
- | HugePages_Free: | + | |
- | HugePages_Rsvd: | + | |
- | HugePages_Surp: | + | |
- | Hugepagesize: | + | |
- | Hugetlb: | + | |
- | DirectMap4k: | + | |
- | DirectMap2M: | + | |
</ | </ | ||
- | ==/proc/ | + | <WRAP center round todo 60%> |
+ | **To do** - **Log out** of your **CentOS8_ROOT_10.0.2.45** session and open a new session using the **CentOS8_SSH_10.0.2.45** connection. | ||
+ | </WRAP> | ||
- | < | + | ====2.2 - Preparing the Environment==== |
- | [root@centos8 ~]# cat / | + | |
- | Linux version 4.18.0-305.3.1.el8.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 8.4.1 20200928 (Red Hat 8.4.1-1) (GCC)) #1 SMP Tue Jun 1 16:14:33 UTC 2021 | + | |
- | </ | + | |
- | ===Répertoires=== | + | To create the Kernel Source Tree in / |
- | ==ide/scsi== | + | < |
+ | [trainee@centos8 ~]$ rpmdev-setuptree | ||
+ | ...> | ||
+ | [trainee@centos8 ~]$ ls -laR rpmbuild/ | ||
+ | rpmbuild/: | ||
+ | total 28 | ||
+ | drwxrwxr-x. | ||
+ | drwxr-xr-x. 17 trainee trainee 4096 Jul 19 12:10 .. | ||
+ | drwxrwxr-x. | ||
+ | drwxrwxr-x. | ||
+ | drwxrwxr-x. | ||
+ | drwxrwxr-x. | ||
+ | drwxrwxr-x. | ||
- | This sub-directory contains disk capacity, disk type and disk geometry information. | + | rpmbuild/ |
+ | total 8 | ||
+ | drwxrwxr-x. 2 trainee trainee 4096 Jul 19 12:10 . | ||
+ | drwxrwxr-x. 7 trainee trainee 4096 Jul 19 12:10 .. | ||
- | ==acpi== | + | rpmbuild/ |
+ | total 8 | ||
+ | drwxrwxr-x. 2 trainee trainee 4096 Jul 19 12:10 . | ||
+ | drwxrwxr-x. 7 trainee trainee 4096 Jul 19 12:10 .. | ||
- | This sub-directory contains information on energy management, temperatures, | + | rpmbuild/ |
+ | total 8 | ||
+ | drwxrwxr-x. 2 trainee trainee 4096 Jul 19 12:10 . | ||
+ | drwxrwxr-x. 7 trainee trainee 4096 Jul 19 12:10 .. | ||
- | ==bus== | + | rpmbuild/ |
+ | total 8 | ||
+ | drwxrwxr-x. 2 trainee trainee 4096 Jul 19 12:10 . | ||
+ | drwxrwxr-x. 7 trainee trainee 4096 Jul 19 12:10 .. | ||
- | This sub-directory contains a sub-directory for each bus. | + | rpmbuild/ |
+ | total 8 | ||
+ | drwxrwxr-x. 2 trainee trainee 4096 Jul 19 12:10 . | ||
+ | drwxrwxr-x. 7 trainee trainee 4096 Jul 19 12:10 .. | ||
+ | </ | ||
- | ==net== | + | Download the Kernel source RPM: |
- | This sub-directory contains information concerning the network. | + | < |
+ | [trainee@centos8 ~]$ uname -a | ||
+ | Linux centos8.ittraining.loc 4.18.0-305.7.1.el8_4.x86_64 #1 SMP Tue Jun 29 21:55:12 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux | ||
- | ==sys== | + | [trainee@centos8 ~]$ cat / |
+ | CentOS Linux release 8.4.2105 | ||
- | This sub-directory contains files used by root to configure the kernel. | + | [trainee@centos8 ~]$ wget https:// |
+ | --2021-07-14 02: | ||
+ | Resolving vault.centos.org (vault.centos.org)... 81.171.33.194, 2a05: | ||
+ | Connecting | ||
+ | HTTP request sent, awaiting response... 200 OK | ||
+ | Length: 123000617 (117M) [application/ | ||
+ | Saving to: ‘kernel-4.18.0-305.7.1.el8_4.src.rpm’ | ||
- | # echo 1 > /proc/ | + | kernel-4.18.0-305.7.1. 100%[===========================>] 117.30M |
- | ====2.2 - Using the sysctl Command==== | + | 2021-07-14 02:55:33 (1.49 MB/s) - ‘kernel-4.18.0-305.7.1.el8_4.src.rpm’ saved [123000617/ |
- | + | </code> | |
- | Files in the **/proc/sys** can be administered by using the **sysctl** command. | + | |
- | The **sysctl** command applies rules at system boot that are defined in the **/ | + | Now install |
< | < | ||
- | [root@centos8 ~]# cat / | + | [trainee@centos8 ~]$ su - |
- | # sysctl settings are defined through files in | + | Mot de passe : fenestros |
- | # / | + | |
- | # | + | |
- | # Vendors settings live in / | + | |
- | # To override a whole file, create a new file with the same in | + | |
- | # / | + | |
- | # only specific settings, add a file with a lexically later | + | |
- | # name in / | + | |
- | # | + | |
- | # For more information, | + | |
- | [root@centos8 ~]# ls -l / | + | [root@centos8 ~]# dnf install yum-utils |
- | total 0 | + | ... |
- | lrwxrwxrwx. 1 root root 14 Mar 16 15:42 99-sysctl.conf -> ../ | + | |
- | [root@centos8 ~]# ls -l / | + | |
- | total 24 | + | |
- | -rw-r--r--. 1 root root 1810 Dec 22 2020 10-default-yama-scope.conf | + | |
- | -rw-r--r--. 1 root root 524 Mar 16 15:42 50-coredump.conf | + | |
- | -rw-r--r--. 1 root root 1270 Mar 16 15:42 50-default.conf | + | |
- | -rw-r--r--. 1 root root 246 Jun 15 2020 50-libkcapi-optmem_max.conf | + | |
- | -rw-r--r--. 1 root root 636 Mar 16 15:42 50-pid-max.conf | + | |
- | -rw-r--r--. 1 root root 499 Nov 26 2019 60-libvirtd.conf | + | |
- | [root@centos8 ~]# cat /usr/lib/sysctl.d/50-default.conf | + | [root@centos8 ~]# yum-builddep |
- | # This file is part of systemd. | + | ... |
- | # | + | </ |
- | # systemd is free software; you can redistribute it and/or modify it | + | |
- | # under the terms of the GNU Lesser General Public License as published by | + | |
- | # the Free Software Foundation; either version 2.1 of the License, or | + | |
- | # (at your option) any later version. | + | |
- | # See sysctl.d(5) and core(5) for documentation. | + | Install the **kernel-4.18.0-305.7.1.el8_4.src.rpm** package: |
- | # To override settings in this file, create a local file in /etc | + | < |
- | # (e.g. /etc/sysctl.d/90-override.conf), and put any assignments | + | [root@centos8 ~]# exit |
- | # there. | + | logout |
+ | [trainee@centos8 ~]$ rpm -Uvh kernel-4.18.0-305.7.1.el8_4.src.rpm | ||
+ | Updating | ||
+ | | ||
+ | warning: group mockbuild does not exist - using root | ||
+ | warning: user mockbuild does not exist - using root | ||
+ | warning: group mockbuild does not exist - using root | ||
+ | warning: user mockbuild does not exist - using root | ||
+ | warning: group mockbuild does not exist - using root | ||
+ | warning: user mockbuild does not exist - using root | ||
+ | warning: group mockbuild does not exist - using root | ||
+ | warning: user mockbuild does not exist - using root | ||
+ | warning: group mockbuild does not exist - using root | ||
+ | warning: user mockbuild does not exist - using root | ||
+ | warning: group mockbuild does not exist - using root | ||
+ | warning: user mockbuild does not exist - using root | ||
+ | warning: group mockbuild does not exist - using root | ||
+ | warning: user mockbuild does not exist - using root | ||
+ | warning: group mockbuild does not exist - using root | ||
+ | warning: user mockbuild does not exist - using root | ||
+ | warning: group mockbuild does not exist - using root | ||
+ | warning: user mockbuild does not exist - using root | ||
+ | warning: group mockbuild does not exist - using root | ||
+ | warning: user mockbuild does not exist - using root | ||
+ | warning: group mockbuild does not exist - using root | ||
+ | warning: user mockbuild does not exist - using root | ||
+ | warning: group mockbuild does not exist - using root | ||
+ | warning: user mockbuild does not exist - using root | ||
+ | warning: group mockbuild does not exist - using root | ||
+ | warning: user mockbuild does not exist - using root | ||
+ | warning: group mockbuild does not exist - using root | ||
+ | warning: user mockbuild does not exist - using root | ||
+ | warning: group mockbuild does not exist - using root | ||
+ | warning: user mockbuild does not exist - using root | ||
+ | warning: group mockbuild does not exist - using root | ||
+ | warning: user mockbuild does not exist - using root | ||
+ | warning: group mockbuild does not exist - using root | ||
+ | warning: user mockbuild does not exist - using root | ||
+ | warning: group mockbuild does not exist - using root | ||
+ | warning: user mockbuild does not exist - using root | ||
+ | warning: group mockbuild does not exist - using root | ||
+ | warning: user mockbuild does not exist - using root | ||
+ | warning: group mockbuild does not exist - using root | ||
+ | warning: user mockbuild does not exist - using root | ||
+ | warning: group mockbuild does not exist - using root | ||
+ | warning: user mockbuild does not exist - using root | ||
+ | warning: group mockbuild does not exist - using root | ||
+ | warning: user mockbuild does not exist - using root | ||
+ | warning: group mockbuild does not exist - using root | ||
+ | warning: user mockbuild does not exist - using root | ||
+ | warning: group mockbuild does not exist - using root | ||
+ | warning: user mockbuild does not exist - using root | ||
+ | warning: group mockbuild does not exist - using root | ||
+ | warning: user mockbuild does not exist - using root | ||
+ | warning: group mockbuild does not exist - using root | ||
+ | warning: user mockbuild does not exist - using root | ||
+ | warning: group mockbuild does not exist - using root | ||
+ | warning: user mockbuild does not exist - using root | ||
+ | warning: group mockbuild does not exist - using root | ||
+ | warning: user mockbuild does not exist - using root | ||
+ | warning: group mockbuild does not exist - using root | ||
+ | warning: user mockbuild does not exist - using root | ||
+ | warning: group mockbuild does not exist - using root | ||
+ | warning: user mockbuild does not exist - using root | ||
+ | warning: group mockbuild does not exist - using root | ||
+ | warning: user mockbuild does not exist - using root | ||
+ | warning: group mockbuild does not exist - using root | ||
+ | warning: user mockbuild does not exist - using root | ||
+ | warning: group mockbuild does not exist - using root | ||
+ | warning: user mockbuild does not exist - using root | ||
+ | warning: group mockbuild does not exist - using root | ||
+ | warning: user mockbuild does not exist - using root | ||
+ | warning: group mockbuild does not exist - using root | ||
+ | warning: user mockbuild does not exist - using root | ||
+ | warning: group mockbuild does not exist - using root | ||
+ | warning: user mockbuild does not exist - using root | ||
+ | warning: group mockbuild does not exist - using root | ||
+ | warning: user mockbuild does not exist - using root | ||
+ | warning: group mockbuild does not exist - using root | ||
+ | warning: user mockbuild does not exist - using root | ||
+ | warning: group mockbuild does not exist - using root | ||
+ | warning: user mockbuild does not exist - using root | ||
+ | warning: group mockbuild does not exist - using root | ||
+ | warning: user mockbuild does not exist - using root | ||
+ | warning: group mockbuild does not exist - using root | ||
+ | warning: user mockbuild does not exist - using root | ||
+ | warning: group mockbuild does not exist - using root | ||
+ | ################################# | ||
+ | warning: user mockbuild does not exist - using root | ||
+ | warning: group mockbuild does not exist - using root | ||
+ | warning: user mockbuild does not exist - using root | ||
+ | warning: group mockbuild does not exist - using root | ||
+ | warning: user mockbuild does not exist - using root | ||
+ | warning: group mockbuild does not exist - using root | ||
+ | warning: user mockbuild does not exist - using root | ||
+ | warning: group mockbuild does not exist - using root | ||
+ | warning: user mockbuild does not exist - using root | ||
+ | warning: group mockbuild does not exist - using root | ||
+ | warning: user mockbuild does not exist - using root | ||
+ | warning: group mockbuild does not exist - using root | ||
+ | warning: user mockbuild does not exist - using root | ||
+ | warning: group mockbuild does not exist - using root | ||
+ | warning: user mockbuild does not exist - using root | ||
+ | warning: group mockbuild does not exist - using root | ||
+ | </ | ||
- | # System Request functionality of the kernel (SYNC) | + | <WRAP center round important 60%> |
- | # | + | **Important** - Note that the errors are not important. |
- | # Use kernel.sysrq = 1 to allow all keys. | + | </WRAP> |
- | # See https:// | + | |
- | # of values and keys. | + | |
- | kernel.sysrq = 16 | + | |
- | # Append the PID to the core filename | + | ====2.3 - Preparing the Kernel Source Tree==== |
- | kernel.core_uses_pid | + | |
- | # https://bugzilla.redhat.com/ | + | Move to the **~/rpmbuild/SPECS** directory and use the **rpmbuild** command to create the Kernel Source Tree: |
- | kernel.kptr_restrict = 1 | + | |
- | # Source route verification | + | < |
- | net.ipv4.conf.all.rp_filter = 1 | + | [trainee@centos7 ~]$ cd ~/ |
- | + | [trainee@centos7 SPECS]$ rpmbuild -bp --target=$(uname -m) kernel.spec | |
- | # Do not accept source routing | + | ... |
- | net.ipv4.conf.all.accept_source_route | + | |
- | + | ||
- | # Promote secondary addresses when the primary address is removed | + | |
- | net.ipv4.conf.all.promote_secondaries = 1 | + | |
- | + | ||
- | # Fair Queue CoDel packet scheduler to fight bufferbloat | + | |
- | net.core.default_qdisc = fq_codel | + | |
- | + | ||
- | # Enable hard and soft link protection | + | |
- | fs.protected_hardlinks = 1 | + | |
- | fs.protected_symlinks = 1 | + | |
</ | </ | ||
- | The command line switches | + | At the end of the process, check what has been created: |
< | < | ||
- | Usage: | + | [trainee@centos8 SPECS]$ ls -la ~/ |
- | | + | total 812 |
- | + | drwxr-xr-x. | |
- | Options: | + | drwxr-xr-x. |
- | -a, --all display all variables | + | drwxr-xr-x. |
- | -A alias of -a | + | drwxr-xr-x. 3 trainee trainee |
- | -X alias of -a | + | drwxr-xr-x. 2 trainee trainee |
- | --deprecated | + | -rw-r--r--. |
- | -b, --binary | + | -rw-r--r--. |
- | -e, --ignore | + | drwxr-xr-x. 2 trainee trainee |
- | -N, --names print variable names without values | + | -rw-r--r--. |
- | -n, --values | + | -rw-r--r--. |
- | -p, --load[=< | + | drwxr-xr-x. 4 trainee trainee |
- | -f alias of -p | + | drwxr-xr-x. 119 trainee trainee |
- | --system | + | drwxr-xr-x. 137 trainee trainee |
- | -r, --pattern < | + | drwxr-xr-x. |
- | select setting that match expression | + | drwxr-xr-x. |
- | -q, --quiet do not echo variable set | + | -rw-r--r--. 1 trainee trainee |
- | -w, --write enable writing a value to variable | + | -rw-r--r--. |
- | -o does nothing | + | -rw-r--r--. 1 trainee trainee |
- | -x does nothing | + | -rw-r--r--. 1 trainee trainee |
- | -d alias of -h | + | -rw-r--r--. 1 trainee trainee |
- | + | drwxr-xr-x. | |
- | -h, --help | + | drwxr-xr-x. 2 trainee trainee |
- | -V, --version | + | drwxr-xr-x. 2 trainee trainee |
- | + | -rw-r--r--. 1 trainee trainee | |
- | For more details see sysctl(8). | + | -rw-r--r--. |
+ | drwxr-xr-x. | ||
+ | drwxr-xr-x. 20 trainee trainee | ||
+ | drwxr-xr-x. 5 trainee trainee | ||
+ | -rw-r--r--. 1 trainee trainee | ||
+ | -rw-r--r--. | ||
+ | -rw-r--r--. | ||
+ | -rw-r--r--. | ||
+ | -rw-r--r--. | ||
+ | drwxr-xr-x. 3 trainee trainee | ||
+ | drwxr-xr-x. | ||
+ | -rw-r--r--. | ||
+ | drwxr-xr-x. | ||
+ | -rw-r--r--. 1 trainee trainee | ||
+ | drwxr-xr-x. 14 trainee trainee | ||
+ | drwxr-xr-x. 10 trainee trainee | ||
+ | drwxr-xr-x. | ||
+ | drwxr-xr-x. 33 trainee trainee | ||
+ | drwxr-xr-x. | ||
+ | drwxr-xr-x. | ||
</ | </ | ||
- | =====LAB#3 - Interpreting Information in / | + | ===The .config File=== |
- | + | ||
- | The information found in files in the /proc filesystem can be interpreted using the following commands: | + | |
- | + | ||
- | * free, | + | |
- | * uptime et w, | + | |
- | * iostat, | + | |
- | * hdparm | + | |
- | * vmstat, | + | |
- | * mpstat, | + | |
- | * sar. | + | |
- | + | ||
- | ====3.1 - The free Command==== | + | |
- | The **free** command shows total, used, free, shared, buffered, cached and swapped memory: | + | Move to **~/ |
< | < | ||
- | [root@centos8 | + | [trainee@centos8 |
- | total used free shared | + | |
- | Mem: | + | |
- | Swap: 3279 | + | |
</ | </ | ||
- | In the above example, you can see: | + | Copy the **configs/ |
- | + | ||
- | | + | |
- | | + | |
- | | + | |
- | + | ||
- | The command line switches of this command are: | + | |
< | < | ||
- | [root@centos8 | + | [trainee@centos8 |
- | + | ||
- | Usage: | + | |
- | free [options] | + | |
- | + | ||
- | Options: | + | |
- | -b, --bytes | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | -k, --kibi | + | |
- | -m, --mebi | + | |
- | -g, --gibi | + | |
- | | + | |
- | | + | |
- | -h, --human | + | |
- | | + | |
- | -l, --lohi | + | |
- | -t, --total | + | |
- | -s N, --seconds N | + | |
- | -c N, --count N | + | |
- | -w, --wide | + | |
- | + | ||
- | | + | |
- | -V, --version | + | |
- | + | ||
- | For more details see free(1). | + | |
</ | </ | ||
- | ====3.2 - The uptime and w Commands==== | + | Update |
- | + | ||
- | Each of these commands show the load average over the past 1, 5 and 15 minutes: | + | |
< | < | ||
- | [root@centos8 | + | [trainee@centos8 |
- | | + | scripts/ |
- | + | # | |
- | [root@centos8 ~]# w | + | # configuration written to .config |
- | | + | # |
- | USER | + | |
- | trainee | + | |
</ | </ | ||
- | The **load average** indicates | + | <WRAP center round important 60%> |
+ | **Important** - The above command reads the .config file of the current Kernel | ||
+ | </ | ||
- | If the load average of a single-core system was **3.48 4.00 3.85** this would indicate a bottleneck since, on average: | + | The **.config** file is generated by one of three binaries and should not be edited manually: |
- | * 2.48 processes would have been waiting to be executed over the last minute, | + | * make config |
- | * 3.00 processes would have been waiting to be executed over the last 5 minutes, | + | * make menuconfig |
- | * 2.85 processes would have been waiting to be executed over the last 15 minutes, | + | * make xconfig |
- | + | ||
- | The command | + | Run the **make menuconfig** |
< | < | ||
- | [root@centos8 | + | [trainee@centos8 |
+ | UPD | ||
+ | HOSTCC | ||
+ | HOSTCC | ||
+ | HOSTCC | ||
+ | HOSTCC | ||
+ | HOSTCC | ||
+ | HOSTCC | ||
+ | HOSTCC | ||
+ | HOSTLD | ||
+ | scripts/ | ||
+ | # | ||
+ | # using defaults found in / | ||
+ | # | ||
+ | </ | ||
- | Usage: | + | Looking at the interface, you will see lines used to configure the Kernel. In the case a letter is used, these are: |
- | | + | |
- | Options: | + | |
- | -p, --pretty | + | * the configuration is included in the Kernel, |
- | -h, --help | + | * **m**, |
- | -s, --since | + | * the configuration is not included in the Kernel but in a Kernel module, |
- | -V, --version | + | * **n**, |
+ | * the configuration is neither included in the Kernel nor in a Kernel module. | ||
- | For more details see uptime(1). | + | At this stage, simply save the configuration and exit the interface: |
- | [root@centos8 ~]# w --help | + | < |
- | + | *** End of the configuration. | |
- | Usage: | + | *** Execute ' |
- | w [options] | + | |
- | + | ||
- | Options: | + | |
- | -h, --no-header | + | |
- | -u, --no-current | + | |
- | -s, --short | + | |
- | -f, --from | + | |
- | -o, --old-style | + | |
- | -i, --ip-addr | + | |
- | + | ||
- | --help display this help and exit | + | |
- | -V, --version | + | |
- | + | ||
- | For more details see w(1). | + | |
</ | </ | ||
- | ====3.3 - The iostat Command==== | + | Check the presence of the **.config** file: |
- | + | ||
- | The **iostat** command show disk, terminal and streamer statistics: | + | |
< | < | ||
- | [root@centos8 | + | [trainee@centos8 |
- | bash: iostat: command not found... | + | . |
- | Install package ' | + | .. |
+ | arch | ||
+ | block .config | ||
+ | </code> | ||
- | + | Lokk at the contents | |
- | * Waiting in queue... | + | |
- | The following packages have to be installed: | + | |
- | | + | |
- | | + | |
- | Proceed with changes? [N/y] y | + | |
- | + | ||
- | + | ||
- | * Waiting in queue... | + | |
- | * Waiting for authentication... | + | |
- | * Waiting in queue... | + | |
- | * Downloading packages... | + | |
- | * Requesting data... | + | |
- | * Testing changes... | + | |
- | * Installing packages... | + | |
- | Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc) | + | |
- | + | ||
- | avg-cpu: | + | |
- | | + | |
- | + | ||
- | Device | + | |
- | sda | + | |
- | sdb | + | |
- | scd0 0.00 | + | |
- | dm-0 0.26 | + | |
- | dm-1 0.00 | + | |
- | </ | + | |
< | < | ||
- | [root@centos8 | + | [trainee@centos8 |
- | Linux 4.18.0-305.3.1.el8.x86_64 | + | # |
+ | # Automatically generated file; DO NOT EDIT. | ||
+ | # Linux/x86 4.18.0 Kernel Configuration | ||
+ | # | ||
- | Device | + | # |
- | sda 0.20 0.16 | + | # Compiler: gcc (GCC) 8.4.1 20200928 (Red Hat 8.4.1-1) |
- | sdb 0.00 0.00 0.02 0.00 | + | # |
- | scd0 | + | CONFIG_64BIT=y |
- | dm-0 | + | CONFIG_X86_64=y |
- | dm-1 | + | CONFIG_X86=y |
+ | CONFIG_INSTRUCTION_DECODER=y | ||
+ | CONFIG_OUTPUT_FORMAT=" | ||
+ | CONFIG_ARCH_DEFCONFIG=" | ||
+ | CONFIG_LOCKDEP_SUPPORT=y | ||
+ | CONFIG_STACKTRACE_SUPPORT=y | ||
+ | CONFIG_MMU=y | ||
+ | CONFIG_ARCH_MMAP_RND_BITS_MIN=28 | ||
+ | CONFIG_ARCH_MMAP_RND_BITS_MAX=32 | ||
+ | CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=8 | ||
+ | CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=16 | ||
+ | CONFIG_GENERIC_ISA_DMA=y | ||
+ | CONFIG_GENERIC_BUG=y | ||
+ | CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y | ||
+ | CONFIG_GENERIC_HWEIGHT=y | ||
+ | CONFIG_ARCH_MAY_HAVE_PC_FDC=y | ||
+ | CONFIG_GENERIC_CALIBRATE_DELAY=y | ||
+ | CONFIG_ARCH_HAS_CPU_RELAX=y | ||
+ | CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y | ||
+ | CONFIG_ARCH_HAS_FILTER_PGPROT=y | ||
+ | CONFIG_HAVE_SETUP_PER_CPU_AREA=y | ||
+ | CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y | ||
+ | CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y | ||
+ | CONFIG_ARCH_HIBERNATION_POSSIBLE=y | ||
+ | CONFIG_ARCH_SUSPEND_POSSIBLE=y | ||
+ | CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y | ||
+ | CONFIG_ARCH_WANT_GENERAL_HUGETLB=y | ||
+ | CONFIG_ZONE_DMA32=y | ||
+ | CONFIG_AUDIT_ARCH=y | ||
+ | CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y | ||
+ | CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y | ||
+ | CONFIG_HAVE_INTEL_TXT=y | ||
+ | CONFIG_X86_64_SMP=y | ||
+ | --More--(0%) | ||
</ | </ | ||
- | The command line switches of this command are: | + | ===The Makefile File=== |
- | < | + | The Makefile contains the Kernel name and the following information: |
- | [root@centos8 ~]# iostat --help | + | |
- | Usage: iostat [ options ] [ < | + | |
- | Options are: | + | |
- | [ -c ] [ -d ] [ -h ] [ -k | -m ] [ -N ] [ -s ] [ -t ] [ -V ] [ -x ] [ -y ] [ -z ] | + | |
- | [ -j { ID | LABEL | PATH | UUID | ... } ] [ --human ] [ -o JSON ] | + | |
- | [ [ -H ] -g < | + | |
- | [ < | + | |
- | </ | + | |
- | ====3.4 - The hdparm Command==== | + | * VERSION, |
+ | * PATCHLEVEL, | ||
+ | * SUBLEVEL, | ||
+ | * EXTRAVERSION. | ||
- | The hdparm command measures disk reads: | + | Values for the first three directives are managed directly by **kernel.org** and Linus Torvalds whilst the EXTRAVERSION is managed by Red Hat: |
< | < | ||
- | [root@centos8 | + | [trainee@centos8 |
+ | # SPDX-License-Identifier: | ||
+ | VERSION = 4 | ||
+ | PATCHLEVEL = 18 | ||
+ | SUBLEVEL = 0 | ||
+ | EXTRAVERSION = | ||
+ | NAME = Merciless Moray | ||
- | /dev/sda: | + | # |
- | Timing buffered disk reads: 1410 MB in 3.00 seconds | + | # DRM backport version |
- | </ | + | # |
+ | RHEL_DRM_VERSION | ||
+ | RHEL_DRM_PATCHLEVEL = 9 | ||
+ | RHEL_DRM_SUBLEVEL = 14 | ||
- | ====3.5 - La Commande vmstat==== | + | # *DOCUMENTATION* |
+ | # To see a list of typical targets execute "make help" | ||
+ | # More info can be located in ./README | ||
+ | # Comments in this file are targeted only to the developer, do not | ||
+ | # expect to learn how to build the kernel reading this file. | ||
- | The **vmstat** commands shows memory, pagination and processor statistics: | + | # That's our default target when none is given on the command line |
+ | PHONY := _all | ||
+ | _all: | ||
- | < | + | # o Do not use make's built-in rules and variables |
- | [root@centos8 ~]# vmstat 1 10 | + | # (this increases performance and avoids hard-to-debug behaviour); |
- | procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- | + | # o Look for make include files relative to root of kernel src |
- | | + | MAKEFLAGS += -rR --include-dir=$(CURDIR) |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | </ | + | |
- | The command line switches of this command are: | + | # Avoid funny character set dependencies |
+ | unexport LC_ALL | ||
+ | LC_COLLATE=C | ||
+ | LC_NUMERIC=C | ||
+ | export LC_COLLATE LC_NUMERIC | ||
- | < | + | # Avoid interference with shell env settings |
- | [root@centos8 ~]# vmstat --help | + | unexport GREP_OPTIONS |
- | Usage: | + | # Set RHEL variables |
- | vmstat [options] [delay [count]] | + | # Use this spot to avoid future merge conflicts |
+ | include Makefile.rhelver | ||
- | Options: | + | # We are using a recursive build, so we need to do a little thinking |
- | -a, --active | + | --Plus--(2%) |
- | -f, --forks | + | |
- | -m, --slabs | + | |
- | -n, --one-header | + | |
- | -s, --stats event counter statistics | + | |
- | -d, --disk | + | |
- | -D, --disk-sum | + | |
- | -p, --partition < | + | |
- | -S, --unit < | + | |
- | -w, --wide | + | |
- | -t, --timestamp | + | |
- | + | ||
- | -h, --help | + | |
- | -V, --version | + | |
- | + | ||
- | For more details see vmstat(8). | + | |
</ | </ | ||
<WRAP center round important 60%> | <WRAP center round important 60%> | ||
- | **Important** | + | **Important** |
</ | </ | ||
- | ====3.6 - The mpstat Command==== | + | ====2.4 - Configuring the Kernel==== |
- | La commande | + | Add the value shown by the **uname -i** command to the first line of the .config file: |
< | < | ||
- | [root@centos8 | + | [trainee@centos8 |
- | Linux 4.18.0-305.3.1.el8.x86_64 | + | x86_64 |
+ | [trainee@centos8 linux-4.18.0-305.7.1.el8.x86_64]$ vi .config | ||
+ | [trainee@centos8 | ||
+ | # x86_64 | ||
+ | # | ||
+ | # Automatically generated file; DO NOT EDIT. | ||
+ | # Linux/x86 4.18.0 Kernel Configuration | ||
+ | # | ||
- | 04: | + | # |
- | 04:53:22 | + | # Compiler: gcc (GCC) 8.4.1 20200928 (Red Hat 8.4.1-1) |
+ | # | ||
+ | CONFIG_64BIT=y | ||
</ | </ | ||
- | If there are several CPU's in the system, statistics can be viewed by core and as an average: | + | Rename |
< | < | ||
- | [root@centos8 | + | [trainee@centos8 |
- | Linux 4.18.0-305.3.1.el8.x86_64 | + | [trainee@centos8 linux-4.18.0-305.7.1.el8.x86_64]$ ls ~/ |
- | + | centos-ca-secureboot.der cpupower.config | |
- | 04: | + | centos-dup.x509 |
- | 04: | + | centos-kpatch.x509 debrand-rh-i686-cpu.patch generate_bls_conf.sh |
- | 04: | + | centos.pem debrand-rh_taint.patch |
- | 04: | + | centossecureboot001.der |
- | 04: | + | centossecureboot201.der |
- | 04: | + | centossecurebootca2.der |
- | 04: | + | check-kabi |
- | 04: | + | config-x86_64-generic |
- | 04: | + | |
- | 04: | + | |
</ | </ | ||
- | Finally, mpstat is capable | + | Copy the entire contents |
< | < | ||
- | [root@centos8 | + | [trainee@centos8 |
- | Linux 4.18.0-305.3.1.el8.x86_64 | + | |
- | + | ||
- | 04: | + | |
- | 04: | + | |
- | 04: | + | |
- | 04: | + | |
- | 04: | + | |
- | 04: | + | |
- | 04: | + | |
- | 04: | + | |
- | 04: | + | |
- | 04: | + | |
- | + | ||
- | 04: | + | |
- | 04: | + | |
- | 04: | + | |
- | 04: | + | |
- | 04: | + | |
- | 04: | + | |
- | 04: | + | |
- | 04: | + | |
- | 04: | + | |
- | 04: | + | |
- | + | ||
- | 04: | + | |
- | 04: | + | |
- | 04: | + | |
- | 04: | + | |
- | 04: | + | |
- | 04: | + | |
- | 04: | + | |
- | 04: | + | |
- | 04: | + | |
- | 04: | + | |
- | + | ||
- | 04: | + | |
- | 04: | + | |
- | 04: | + | |
- | 04: | + | |
- | 04: | + | |
- | 04: | + | |
- | 04: | + | |
- | 04: | + | |
- | 04: | + | |
- | 04: | + | |
- | + | ||
- | 04: | + | |
- | 04: | + | |
- | 04: | + | |
- | 04: | + | |
- | 04: | + | |
- | 04: | + | |
- | 04: | + | |
- | 04: | + | |
- | 04: | + | |
- | 04: | + | |
- | + | ||
- | Average: | + | |
- | Average: | + | |
- | Average: | + | |
- | Average: | + | |
- | Average: | + | |
- | Average: | + | |
- | Average: | + | |
- | Average: | + | |
- | Average: | + | |
- | Average: | + | |
</ | </ | ||
- | The command line switches of this command are: | + | Edit the **buildid** directive in the **~/ |
< | < | ||
- | [root@centos8 | + | [trainee@centos8 |
- | Usage: mpstat [ options | + | |
- | Options are: | + | |
- | [ -A ] [ -n ] [ -u ] [ -V ] [ -I { SUM | CPU | SCPU | ALL } ] | + | |
- | [ -N { < | + | |
- | </code> | + | |
- | ====3.7 - The sar Command==== | + | [trainee@centos8 SPECS]$ vi kernel.spec |
- | The **sar** command can survey all system resources dependant upon the switch that is used. Several important switches are: | + | [trainee@centos8 SPECS]$ head -n 50 kernel.spec |
+ | # We have to override the new %%install behavior because, well... | ||
+ | %global __spec_install_pre %{___build_pre} | ||
- | ^ Switch ^ Description ^ | + | # At the time of this writing (2019-03), RHEL8 packages use w2.xzdio |
- | | -u | CPU usage in % | | + | # compression for rpms (xz, level 2). |
- | | -q | Number | + | # Kernel has several large (hundreds |
- | | -r | Memory usage | | + | # to compress by single-threaded xz. Switch to threaded compression, |
- | | -w | Swap usage | | + | # and from level 2 to 3 to keep compressed sizes close to " |
- | | -p | Pagination usage | | + | # |
- | | -b | Buffer usage | | + | # NB: if default compression in / |
- | | -d | Disk usage | | + | # this one might need tweaking (e.g. if default changes to w3.xzdio, |
+ | # change below to w4T.xzdio): | ||
+ | %define _binary_payload w3T.xzdio | ||
- | The **/ | + | # For a kernel released for public testing, released_kernel should be 1. |
+ | # For internal testing builds during development, | ||
+ | %global released_kernel 1 | ||
- | < | + | %global distro_build 305 |
- | [root@centos8 ~]# ls / | + | |
- | sa1 sa2 sadc | + | |
- | </ | + | |
- | The **/ | + | # Sign the x86_64 kernel for secure boot authentication |
+ | %ifarch x86_64 aarch64 | ||
+ | %global signkernel 1 | ||
+ | %else | ||
+ | %global signkernel 0 | ||
+ | %endif | ||
- | ^ Switch ^ Description ^ | + | # Sign modules on all arches |
- | | -t | Interval | | + | %global signmodules 1 |
- | | -n | Count | | + | |
- | The **/ | + | # Compress modules only for architectures that build modules |
+ | %ifarch noarch | ||
+ | %global zipmodules 0 | ||
+ | %else | ||
+ | %global zipmodules 1 | ||
+ | %endif | ||
- | < | + | %if %{zipmodules} |
- | [root@centos8 ~]# ls /var/log/sa/ | + | %global zipsed -e 's/\.ko$/\.ko.xz/' |
- | sa29 s | + | %endif |
+ | %define buildid .i2tch | ||
- | ar29 | + | %define rpmversion 4.18.0 |
- | </ | + | %define pkgrelease 305.7.1.el8_4 |
- | Using CentOS / RHEL 8, the interval between collects is configured using systemd **timers** de systemd and not cron as was previously the case: | + | # allow pkg_release to have configurable %%{?dist} tag |
+ | %define specrelease 305.7.1%{? | ||
- | < | + | %define pkg_release %{specrelease}%{? |
- | [root@centos8 ~]# cat / | + | |
- | # / | + | |
- | # (C) 2014 Tomasz Torcz < | + | |
- | # | + | |
- | # sysstat-11.7.3 systemd unit file: | + | |
- | # Activates activity collector every 10 minutes | + | |
- | + | ||
- | [Unit] | + | |
- | Description=Run system activity accounting tool every 10 minutes | + | |
- | + | ||
- | [Timer] | + | |
- | OnCalendar=*: | + | |
- | + | ||
- | [Install] | + | |
- | WantedBy=sysstat.service | + | |
</ | </ | ||
- | The **OnCalendar** value indicates a collect every 10 minutes. | + | ====2.5 - Compiling the Kernel==== |
- | To change this value, you need to create an **override** file in **/ | + | Compiling |
< | < | ||
- | [root@centos8 ~]# systemctl edit sysstat-collect.timer | + | [trainee@centos7 SPECS]$ rpmbuild |
- | [root@centos8 ~]# cat / | + | |
- | [Unit] | + | |
- | Description=Run system activity accounting tool every 2 minutes | + | |
- | + | ||
- | [Timer] | + | |
- | OnCalendar= | + | |
- | OnCalendar=*: | + | |
- | AccuracySec=0 | + | |
</ | </ | ||
<WRAP center round important 60%> | <WRAP center round important 60%> | ||
- | **Important** | + | **Important** |
</ | </ | ||
- | Now check if the configuration | + | When the compilation |
< | < | ||
- | [root@centos8 ~]# systemctl status sysstat-collect.timer | + | ... |
- | ● sysstat-collect.timer - Run system activity accounting tool every 2 minutes | + | Wrote: / |
- | Loaded: loaded (/usr/lib/systemd/system/sysstat-collect.timer; enabled; vendor preset: disabled) | + | Wrote: / |
- | Drop-In: /etc/systemd/system/sysstat-collect.timer.d | + | Wrote: /home/trainee/rpmbuild/RPMS/x86_64/ |
- | └─override.conf | + | Wrote: / |
- | Active: active (waiting) since Tue 2021-06-29 06:16:04 EDT; 3h 2min ago | + | Wrote: / |
- | | + | Wrote: /home/trainee/rpmbuild/RPMS/ |
+ | Wrote: / | ||
+ | Wrote: / | ||
+ | Wrote: / | ||
+ | Wrote: / | ||
+ | Wrote: / | ||
+ | Wrote: / | ||
+ | Wrote: / | ||
+ | Wrote: / | ||
+ | Wrote: / | ||
+ | Wrote: / | ||
+ | Wrote: / | ||
+ | Wrote: / | ||
+ | Wrote: / | ||
+ | Wrote: / | ||
+ | Wrote: / | ||
+ | Wrote: / | ||
+ | Wrote: / | ||
+ | Wrote: / | ||
+ | Wrote: / | ||
+ | Wrote: / | ||
+ | Wrote: / | ||
+ | Wrote: / | ||
+ | Wrote: / | ||
+ | Executing(%clean): | ||
- | Jun 29 06:16:04 centos8.ittraining.loc systemd[1]: Started Run system activity accounting tool every 10 minutes. | + | [1]+ Done rpmbuild -bb --target=`uname -m` kernel.spec 2> build-err.log | tee build-out.log |
</ | </ | ||
+ | |||
+ | The installable RPMs can be found in the **/ | ||
< | < | ||
- | [root@centos8 | + | [trainee@centos8 |
- | -- Logs begin at Mon 2021-06-28 02:04:10 EDT, end at Tue 2021-06-29 09:18:00 EDT. -- | + | [trainee@centos8 RPMS]$ ls |
- | Jun 29 06:20:33 centos8.ittraining.loc systemd[1]: sysstat-collect.service: Succeeded. | + | x86_64 |
- | Jun 29 06:26:29 centos8.ittraining.loc systemd[1]: sysstat-collect.service: Succeeded. | + | [trainee@centos8 RPMS]$ cd x86_64/ |
- | Jun 29 06:30:33 centos8.ittraining.loc systemd[1]: sysstat-collect.service: Succeeded. | + | [trainee@centos8 x86_64]$ ls |
- | Jun 29 06:40:33 centos8.ittraining.loc systemd[1]: sysstat-collect.service: Succeeded. | + | bpftool-4.18.0-305.7.1.el8.i2tch.x86_64.rpm |
- | Jun 29 06:50:33 centos8.ittraining.loc systemd[1]: sysstat-collect.service: Succeeded. | + | bpftool-debuginfo-4.18.0-305.7.1.el8.i2tch.x86_64.rpm |
- | Jun 29 07:00:33 centos8.ittraining.loc systemd[1]: sysstat-collect.service: Succeeded. | + | kernel-4.18.0-305.7.1.el8.i2tch.x86_64.rpm |
- | Jun 29 07:10:33 centos8.ittraining.loc systemd[1]: sysstat-collect.service: Succeeded. | + | kernel-core-4.18.0-305.7.1.el8.i2tch.x86_64.rpm |
- | Jun 29 07:20:33 centos8.ittraining.loc systemd[1]: sysstat-collect.service: Succeeded. | + | kernel-cross-headers-4.18.0-305.7.1.el8.i2tch.x86_64.rpm |
- | Jun 29 07:30:33 centos8.ittraining.loc systemd[1]: sysstat-collect.service: Succeeded. | + | kernel-debug-4.18.0-305.7.1.el8.i2tch.x86_64.rpm |
- | Jun 29 07:40:33 centos8.ittraining.loc systemd[1]: sysstat-collect.service: Succeeded. | + | kernel-debug-core-4.18.0-305.7.1.el8.i2tch.x86_64.rpm |
- | Jun 29 07:50:33 centos8.ittraining.loc systemd[1]: sysstat-collect.service: Succeeded. | + | kernel-debug-debuginfo-4.18.0-305.7.1.el8.i2tch.x86_64.rpm |
- | Jun 29 07:53:56 centos8.ittraining.loc systemd[1]: sysstat-collect.service: Succeeded. | + | kernel-debug-devel-4.18.0-305.7.1.el8.i2tch.x86_64.rpm |
- | Jun 29 07:54:00 centos8.ittraining.loc systemd[1]: sysstat-collect.service: Succeeded. | + | kernel-debuginfo-4.18.0-305.7.1.el8.i2tch.x86_64.rpm |
- | Jun 29 07:56:00 centos8.ittraining.loc systemd[1]: sysstat-collect.service: Succeeded. | + | |
- | Jun 29 07:58:00 centos8.ittraining.loc systemd[1]: sysstat-collect.service: Succeeded. | + | |
- | Jun 29 08:00:00 centos8.ittraining.loc systemd[1]: sysstat-collect.service: Succeeded. | + | |
- | ... | + | |
</ | </ | ||
- | Execute | + | Note that the compilation has consumed over 20 GB of disk space: |
< | < | ||
- | [root@centos8 | + | [trainee@centos8 |
- | Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc) 29/06/21 _x86_64_ | + | Filesystem |
+ | devtmpfs | ||
+ | tmpfs 1.9G | ||
+ | tmpfs | ||
+ | tmpfs 1.9G | ||
+ | / | ||
+ | / | ||
+ | tmpfs 374M | ||
+ | tmpfs 374M 1.2M 373M 1% / | ||
+ | / | ||
+ | </code> | ||
- | 06: | + | ====2.6 - Installing the Kernel==== |
- | 06: | + | Now install the new Kernel. Installing the new Kernel can take a long time (~2 heures). Use the following command: |
- | 06: | + | |
- | 06:30:33 all 0.02 0.00 0.03 0.00 0.00 | + | |
- | 06: | + | |
- | 06: | + | |
- | 07: | + | |
- | 07: | + | |
- | 07: | + | |
- | 07: | + | |
- | 07: | + | |
- | 07: | + | |
- | 07: | + | |
- | 07: | + | |
- | Average: | + | |
- | 07:55:44 LINUX RESTART | + | < |
+ | [root@centos8 x86_64]# dnf localinstall kernel-*.rpm | ||
+ | Last metadata expiration check: 2:25:32 ago on Tue 20 Jul 2021 08:37:00 EDT. | ||
+ | Dependencies resolved. | ||
+ | =============================================================================================================================================================================================================== | ||
+ | | ||
+ | =============================================================================================================================================================================================================== | ||
+ | Installing: | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | Downgrading: | ||
+ | | ||
+ | | ||
+ | | ||
- | 07: | + | Transaction Summary |
- | 07: | + | =============================================================================================================================================================================================================== |
- | 08: | + | Install |
- | 08: | + | Downgrade |
- | 08: | + | |
- | 08: | + | |
- | 08: | + | |
- | 08: | + | |
- | 08: | + | |
- | 08: | + | |
- | 08: | + | |
- | 08: | + | |
- | 08:20:00 all 0.02 0.00 0.04 0.00 0.00 99.94 | + | |
- | 08: | + | |
- | 08: | + | |
- | 08: | + | |
- | 08: | + | |
- | 08: | + | |
- | 08: | + | |
- | 08: | + | |
- | 08: | + | |
- | 08: | + | |
- | 08: | + | |
- | 08: | + | |
- | 08: | + | |
- | 08: | + | |
- | 08: | + | |
- | 08: | + | |
- | 08: | + | |
- | 08: | + | |
- | 08: | + | |
- | 08: | + | |
- | 09: | + | |
- | 09: | + | |
- | 09: | + | |
- | 09: | + | |
- | 09: | + | |
- | 09: | + | |
- | 09: | + | |
- | 09:12:00 CPU | + | Total size: 1.6 G |
- | 09: | + | Is this ok [y/N]: y |
- | 09:16:00 all 0.02 0.00 0.06 0.00 0.00 | + | |
- | 09: | + | |
- | 09: | + | |
- | Average: | + | |
</ | </ | ||
- | ===CPU Stats=== | + | When all is installed, re-start the virtual machine: |
- | + | ||
- | Use the -u switch: | + | |
< | < | ||
- | [root@centos8 | + | [root@centos7 |
- | Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc) | + | |
- | + | ||
- | 09: | + | |
- | 09: | + | |
- | 09: | + | |
- | 09: | + | |
- | Average: | + | |
</ | </ | ||
- | More information can be shown by using the **ALL** argument: | + | Open a session as trainee and become root. List the installed Kernels: |
< | < | ||
- | [root@centos8 ~]# sar -u ALL 5 3 | + | [root@centos8 ~]# rpm -qa | grep kernel |
- | Linux 4.18.0-305.3.1.el8.x86_64 | + | kernel-modules-4.18.0-305.3.1.el8.x86_64 |
- | + | kernel-tools-4.18.0-305.7.1.el8.i2tch.x86_64 | |
- | 01: | + | kernel-headers-4.18.0-305.7.1.el8.i2tch.x86_64 |
- | 01: | + | kernel-debuginfo-4.18.0-305.7.1.el8.i2tch.x86_64 |
- | 01: | + | kernel-debug-core-4.18.0-305.7.1.el8.i2tch.x86_64 |
- | 01: | + | kernel-modules-internal-4.18.0-305.7.1.el8.i2tch.x86_64 |
- | Average: | + | kernel-modules-4.18.0-305.7.1.el8_4.x86_64 |
+ | kernel-debug-modules-4.18.0-305.7.1.el8.i2tch.x86_64 | ||
+ | kernel-devel-4.18.0-305.7.1.el8.i2tch.x86_64 | ||
+ | kernel-tools-debuginfo-4.18.0-305.7.1.el8.i2tch.x86_64 | ||
+ | kernel-tools-libs-4.18.0-305.7.1.el8.i2tch.x86_64 | ||
+ | kernel-debug-modules-internal-4.18.0-305.7.1.el8.i2tch.x86_64 | ||
+ | kernel-cross-headers-4.18.0-305.7.1.el8.i2tch.x86_64 | ||
+ | kernel-core-4.18.0-305.7.1.el8_4.x86_64 | ||
+ | kernel-devel-4.18.0-305.7.1.el8_4.x86_64 | ||
+ | kernel-debuginfo-common-x86_64-4.18.0-305.7.1.el8.i2tch.x86_64 | ||
+ | kernel-debug-modules-extra-4.18.0-305.7.1.el8.i2tch.x86_64 | ||
+ | kernel-debug-devel-4.18.0-305.7.1.el8.i2tch.x86_64 | ||
+ | kernel-tools-libs-devel-4.18.0-305.7.1.el8.i2tch.x86_64 | ||
+ | kernel-modules-extra-4.18.0-305.7.1.el8.i2tch.x86_64 | ||
+ | kernel-4.18.0-305.7.1.el8_4.x86_64 | ||
+ | kernel-4.18.0-305.7.1.el8.i2tch.x86_64 | ||
+ | kernel-core-4.18.0-305.7.1.el8.i2tch.x86_64 | ||
+ | kernel-selftests-internal-4.18.0-305.7.1.el8.i2tch.x86_64 | ||
+ | kernel-debug-debuginfo-4.18.0-305.7.1.el8.i2tch.x86_64 | ||
+ | kernel-debug-4.18.0-305.7.1.el8.i2tch.x86_64 | ||
+ | kernel-4.18.0-305.3.1.el8.x86_64 | ||
+ | kernel-core-4.18.0-305.3.1.el8.x86_64 | ||
+ | kernel-modules-4.18.0-305.7.1.el8.i2tch.x86_64 | ||
+ | kernel-ipaclones-internal-4.18.0-305.7.1.el8.i2tch.x86_64 | ||
</ | </ | ||
- | To see the statistics | + | Check the **saved-entry** |
< | < | ||
- | [root@centos8 ~]# sar -u -P 1 5 3 | + | [root@centos8 ~]# grep i2tch /boot/grub2/grubenv |
- | Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc) | + | saved_entry=95bd69e34a7444a7b58cb74fbfb86df2-4.18.0-305.7.1.el8.i2tch.x86_64 |
- | + | ||
- | 01: | + | |
- | 01: | + | |
- | 01: | + | |
- | 01: | + | |
- | Average: | + | |
- | [root@centos8 ~]# sar -u -P 5 5 3 | + | |
- | Linux 4.18.0-305.3.1.el8.x86_64 | + | |
- | + | ||
- | 01: | + | |
- | 01: | + | |
- | 01: | + | |
- | 01: | + | |
- | Average: | + | |
</ | </ | ||
- | ===Memory and Swap Statistics=== | + | Finally, check the output of the **uname -r** command: |
- | + | ||
- | Use the **-r** | + | |
< | < | ||
- | [root@centos8 ~]# sar -r 5 3 | + | [root@centos8 ~]# uname -r |
- | Linux 4.18.0-305.3.1.el8.x86_64 | + | 4.18.0-305.7.1.el8.i2tch.x86_64 |
- | + | ||
- | 07: | + | |
- | 07: | + | |
- | 07: | + | |
- | 07: | + | |
- | Average: | + | |
</ | </ | ||
- | Use the **-S** switch to see swap statistics: | + | =====LAB #3 - Managing Quotas===== |
- | < | + | User and group disk quotas can be placed on partitions **only**. |
- | [root@centos8 ~]# sar -S 5 3 | + | |
- | Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc) | + | |
- | 07: | + | <WRAP center round todo 60%> |
- | 07: | + | **To do** - **Log out** of your **CentOS8_SSH_10.0.2.45** session and open a new session using the **CentOS8_ROOT_10.0.2.45** connection. |
- | 07: | + | </WRAP> |
- | 07: | + | |
- | Average: | + | |
- | </code> | + | |
- | ===I/O Statistics=== | + | Before configuring |
- | + | ||
- | Use the **-b** switch: | + | |
< | < | ||
- | [root@centos8 ~]# sar -b 5 3 | + | [root@centos8 ~]# getenforce |
- | Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc) | + | Enforcing |
- | + | [root@centos8 | |
- | 09: | + | [root@centos8 ~]# getenforce |
- | 09: | + | Permissive |
- | 09: | + | [root@centos8 ~]# |
- | 09: | + | |
- | Average: | + | |
</ | </ | ||
- | ===Disk I/O Statistics=== | + | Edit the **/ |
- | + | ||
- | Use the **-d** switch: | + | |
< | < | ||
- | [root@centos8 ~]# sar -d 5 3 | + | [root@centos8 ~]# vi / |
- | Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc) | + | [root@centos8 |
- | 09:25:45 DEV | + | # This file controls the state of SELinux on the system. |
- | 09: | + | # SELINUX= can take one of these three values: |
- | 09: | + | # |
- | 09:25:50 dev11-0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 | + | # |
- | 09: | + | # |
- | 09: | + | SELINUX=permissive |
+ | # SELINUXTYPE= can take one of these three values: | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | SELINUXTYPE=targeted | ||
- | 09: | + | </code> |
- | 09: | + | |
- | 09: | + | |
- | 09: | + | |
- | 09: | + | |
- | 09: | + | |
- | 09:25:55 DEV | + | Now check that the **quota** package is installed: |
- | 09: | + | |
- | 09: | + | |
- | 09: | + | |
- | 09: | + | |
- | 09: | + | |
- | Average: | + | < |
- | Average: | + | [root@centos8 ~]# rpm -qa | grep quota |
- | Average: | + | quota-4.04-12.el8.x86_64 |
- | Average: | + | quota-nls-4.04-12.el8.noarch |
- | Average: | + | |
- | Average: | + | |
</ | </ | ||
- | The **DEV** column identifies the disks by their major/minor numbers. To see the names of the disks add the, **-p** switch: | + | Edit the **/etc/fstab** file and add the **usrquota** and **grpquota** options to the **/home** line: |
< | < | ||
- | [root@centos8 ~]# sar -p -d 5 3 | + | [root@centos8 ~]# vi /etc/fstab |
- | Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc) | + | [root@centos8 |
- | 07: | + | # |
- | 07:48:37 sda 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 | + | # /etc/fstab |
- | 07: | + | # Created by anaconda on Wed Jun 16 06:21:32 2021 |
- | 07: | + | # |
- | 07: | + | # Accessible filesystems, |
- | 07: | + | # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info. |
- | + | # | |
- | 07: | + | # After editing this file, run ' |
- | 07: | + | # units generated from this file. |
- | 07: | + | # |
- | 07: | + | /dev/mapper/ |
- | 07: | + | UUID=1c04981e-5317-4b73-9695-3ce25246835d |
- | 07: | + | / |
- | + | UUID=f76d6b66-985b-4a91-af9c-4987e8c1443c /home | |
- | 07: | + | |
- | 07: | + | |
- | 07: | + | |
- | 07: | + | |
- | 07: | + | |
- | 07: | + | |
- | + | ||
- | Average: | + | |
- | Average: | + | |
- | Average: | + | |
- | Average: | + | |
- | Average: | + | |
- | Average: | + | |
</ | </ | ||
- | The command line switches of this command are: | + | Restart the virtual machine: |
< | < | ||
- | [root@centos8 ~]# sar --help | + | [root@centos8 ~]# reboot |
- | Usage: sar [ options ] [ < | + | |
- | Main options and reports (report name between square brackets): | + | |
- | -B Paging statistics [A_PAGE] | + | |
- | -b I/O and transfer rate statistics [A_IO] | + | |
- | -d Block devices statistics [A_DISK] | + | |
- | -F [ MOUNT ] | + | |
- | Filesystems statistics [A_FS] | + | |
- | -H Hugepages utilization statistics [A_HUGE] | + | |
- | -I { < | + | |
- | Interrupts statistics [A_IRQ] | + | |
- | -m { < | + | |
- | Power management statistics [A_PWR_...] | + | |
- | Keywords are: | + | |
- | CPU CPU instantaneous clock frequency | + | |
- | FAN Fans speed | + | |
- | FREQ CPU average clock frequency | + | |
- | IN Voltage inputs | + | |
- | TEMP Devices temperature | + | |
- | USB USB devices plugged into the system | + | |
- | -n { < | + | |
- | Network statistics [A_NET_...] | + | |
- | Keywords are: | + | |
- | DEV | + | |
- | EDEV Network interfaces (errors) | + | |
- | NFS NFS client | + | |
- | NFSD NFS server | + | |
- | SOCK Sockets (v4) | + | |
- | IP IP traffic | + | |
- | EIP IP traffic | + | |
- | ICMP ICMP traffic | + | |
- | EICMP ICMP traffic | + | |
- | TCP TCP traffic | + | |
- | ETCP TCP traffic | + | |
- | UDP UDP traffic | + | |
- | SOCK6 | + | |
- | IP6 IP traffic | + | |
- | EIP6 IP traffic | + | |
- | ICMP6 ICMP traffic | + | |
- | EICMP6 | + | |
- | UDP6 UDP traffic | + | |
- | FC Fibre channel HBAs | + | |
- | SOFT Software-based network processing | + | |
- | -q Queue length and load average statistics [A_QUEUE] | + | |
- | -r [ ALL ] | + | |
- | Memory utilization statistics [A_MEMORY] | + | |
- | -S Swap space utilization statistics [A_MEMORY] | + | |
- | -u [ ALL ] | + | |
- | CPU utilization statistics [A_CPU] | + | |
- | -v Kernel tables statistics [A_KTABLES] | + | |
- | -W Swapping statistics [A_SWAP] | + | |
- | -w Task creation and system switching statistics [A_PCSW] | + | |
- | -y TTY devices statistics [A_SERIAL] | + | |
</ | </ | ||
- | =====USB Modules===== | + | <WRAP center round todo 60%> |
+ | **To do** - Open a new session using the **CentOS8_ROOT_10.0.2.45** connection. | ||
+ | </ | ||
- | The Universal Serial Bus can offer data transfer speeds of upto 480Mb/s for version 2.0 and upto 4.8 Gb/s for version 3.0. Under Linux the USB modules are: | + | Check that the **usrquota** |
- | ^ USB Version ^ Module ^ Name ^ | + | < |
- | | 1.0\1.1 | + | [root@centos8 ~]# cat /etc/mtab | grep /home |
- | | ::: | **OHCI** | //Open Controller Host Interface// | | + | /dev/sdc1 /home ext4 rw, |
- | | 2.0 | **EHCI** | //Enhanced Host Controller Interface// | | + | </code> |
- | | 3.0 | **XHCI** | //Extensible Host Controller Interface// | | + | |
- | The following table shows a list of commonly used USB modules: | + | ====3.1 - The quotacheck Command==== |
- | ^ Module ^ Peripheral ^ | + | To activate the quotas on /home, use the **quotacheck** command: |
- | | | + | |
- | | **usbhid** | + | |
- | | **snd-usb-audio** | + | |
- | | **usbvidéo** | + | |
- | | **irda-usb** | + | |
- | | **usbnet** | + | |
- | These modules can be loaded by any one of the following: | + | < |
+ | [root@centos8 ~]# quotacheck -cugvm -f /dev/sdc1 | ||
+ | quotacheck: Your kernel probably supports journaled quota but you are not using it. Consider switching to journaled quota to avoid running quotacheck after an unclean shutdown. | ||
+ | quotacheck: Scanning /dev/sdc1 [/home] done | ||
+ | quotacheck: Cannot stat old user quota file / | ||
+ | quotacheck: Cannot stat old group quota file / | ||
+ | quotacheck: Cannot stat old user quota file / | ||
+ | quotacheck: Cannot stat old group quota file / | ||
+ | quotacheck: Checked 6763 directories and 129772 files | ||
+ | quotacheck: Old file not found. | ||
+ | quotacheck: Old file not found. | ||
+ | </ | ||
- | * Initramfs, | + | The command line switches of the **quotacheck** command are as follows: |
- | * The init process, | + | |
- | * kmod by using the **/ | + | |
- | | + | |
- | | + | |
- | =====udev===== | + | < |
+ | [root@centos8 ~]# quotacheck --help | ||
+ | Utility for checking and repairing quota files. | ||
+ | quotacheck [-gucbfinvdmMR] [-F < | ||
- | Since the 2.6 Kernel series, Linux capable | + | -u, --user |
+ | -g, --group | ||
+ | -c, --create-files | ||
+ | -b, --backup | ||
+ | -f, --force | ||
+ | -i, --interactive | ||
+ | -n, --use-first-dquot | ||
+ | -v, --verbose | ||
+ | -d, --debug | ||
+ | -m, --no-remount | ||
+ | -M, --try-remount | ||
+ | continue even if it fails | ||
+ | -R, --exclude-root | ||
+ | -F, --format=formatname | ||
+ | -a, --all check all filesystems | ||
+ | -h, --help | ||
+ | -V, --version | ||
- | * Udev, | + | Bugs to jack@suse.cz |
- | * HAL, | + | </ |
- | * Dbus. | + | |
- | The roles of each componant are as follows: | + | Two files, **aquota.user** and **aquota.group** are created |
- | + | ||
- | * Udev dynamically creates/ | + | |
- | * HAL obtains information from udev, creates a files in XML format representing the peripheral and then informs Nautilus by using Dbus, | + | |
- | | + | |
- | + | ||
- | When Linux is booted, udev plays an important role: | + | |
- | + | ||
- | | + | |
- | * udev copies any statically configured nodes from **/ | + | |
- | * the **udevd** daemon collects **uevents** from the kernel and looks for anappropriate rule in the **/ | + | |
- | * udev creates the nodes and any required symbolic links specified in the rule previously identified, | + | |
- | | + | |
- | * when a change occurs udev updates the the rules in the RAM. | + | |
- | + | ||
- | udev uses the **sysfs** filesystem mounted on /sys which renders the peripherals visible to udev in user space. For example when a USB stick is inserted, udev creates **/ | + | |
- | + | ||
- | The main configuration file for udev is **/ | + | |
< | < | ||
- | [root@centos8 ~]# cat /etc/ | + | [root@centos8 ~]# ls -la /home |
- | # see udev.conf(5) for details | + | total 40 |
- | # | + | drwxr-xr-x. |
- | # udevd is also started in the initrd. | + | dr-xr-xr-x. 17 root root 224 Jul 19 12:05 .. |
- | # also want to rebuild the initrd, so that it will include the modified configuration. | + | -rw-------. |
- | + | -rw-------. | |
- | # | + | drwx------. 2 root root 16384 Jul 19 12:02 lost+found |
+ | drwxr-xr-x. 17 trainee trainee | ||
</ | </ | ||
- | Rules files can be foud in **/ | + | Now create a user called |
< | < | ||
- | [root@centos8 ~]# ls /lib/udev/rules.d/ | + | [root@centos8 ~]# groupadd fenestros && useradd fenestros -c FenestrOs -d /home/fenestros -g fenestros -s /bin/bash |
- | 01-md-raid-creating.rules | + | [root@centos8 ~]# passwd fenestros |
- | 10-dm.rules 70-wacom.rules | + | Changing password for user fenestros. |
- | 11-dm-lvm.rules | + | New password: |
- | 11-dm-mpath.rules | + | BAD PASSWORD: The password contains the user name in some form |
- | 11-dm-parts.rules | + | Retype new password: |
- | 13-dm-disk.rules | + | passwd: all authentication tokens updated successfully. |
- | 39-usbmuxd.rules | + | |
- | 40-elevator.rules | + | |
- | 40-libgphoto2.rules | + | |
- | 40-redhat.rules | + | |
- | 40-usb-blacklist.rules | + | |
- | 40-usb_modeswitch.rules | + | |
- | 50-udev-default.rules | + | |
- | 60-alias-kmsg.rules | + | |
- | 60-block.rules | + | |
- | 60-cdrom_id.rules | + | |
- | 60-drm.rules | + | |
- | 60-evdev.rules | + | |
- | 60-fido-id.rules | + | |
- | 60-input-id.rules | + | |
- | 60-libfprint-2-autosuspend.rules | + | |
- | 60-net.rules | + | |
- | 60-persistent-alsa.rules | + | |
- | 60-persistent-input.rules | + | |
- | 60-persistent-storage.rules | + | |
- | 60-persistent-storage-tape.rules | + | |
- | 60-persistent-v4l.rules | + | |
- | 60-raw.rules | + | |
- | 60-rdma-ndd.rules | + | |
- | 60-rdma-persistent-naming.rules | + | |
- | 60-sensor.rules | + | |
- | 60-serial.rules | + | |
- | 60-tpm-udev.rules | + | |
- | 61-gdm.rules | + | |
- | 61-gnome-bluetooth-rfkill.rules | + | |
- | 61-gnome-settings-daemon-rfkill.rules | + | |
- | 61-scsi-sg3_id.rules | + | |
- | 62-multipath.rules | + | |
- | 63-fc-wwpn-id.rules | + | |
- | 63-md-raid-arrays.rules | + | |
- | 63-scsi-sg3_symlink.rules | + | |
- | 64-btrfs.rules | + | |
- | 64-md-raid-assembly.rules | + | |
- | 65-libwacom.rules | + | |
- | 65-md-incremental.rules | + | |
- | 65-sane-backends.rules | + | |
- | 66-kpartx.rules | + | |
- | 68-del-part-nodes.rules | + | |
- | 69-btattach-bcm.rules | + | |
- | 69-cd-sensors.rules | + | |
- | 69-dm-lvm-metad.rules | + | |
- | 69-libmtp.rules | + | |
- | 69-md-clustered-confirm-device.rules | + | |
- | 70-hypervfcopy.rules | + | |
- | 70-hypervkvp.rules | + | |
- | 70-hypervvss.rules | + | |
- | 70-joystick.rules | + | |
- | 70-mouse.rules | + | |
- | 70-nvmf-autoconnect.rules | + | |
- | 70-power-switch.rules | + | |
- | 70-printers.rules | + | |
- | 70-spice-vdagentd.rules | + | |
- | 70-touchpad.rules | + | |
</ | </ | ||
- | <WRAP center round important 60%> | + | ====3.2 |
- | **Important** : You can create your own rules by putting them in the **99-local.rules** file. | + | |
- | </ | + | |
- | The default udev rule file is **50-udev-default.rules**: | + | Set a 10Mo quota for the fenestros user: |
< | < | ||
- | [root@centos8 ~]# cat / | + | [root@centos8 ~]# edquota |
- | # do not edit this file, it will be overwritten on update | + | </ |
- | # run a command on remove events | + | The **vi** editor launches and you will see the following output: |
- | ACTION==" | + | |
- | ACTION==" | + | |
- | SUBSYSTEM==" | + | < |
+ | Disk quotas for user fenestros (uid 1001): | ||
+ | Filesystem | ||
+ | | ||
+ | </ | ||
- | # select " | + | Change |
- | SUBSYSTEM==" | + | |
- | SUBSYSTEM==" | + | |
- | SUBSYSTEM==" | + | < |
- | ENV{MODALIAS}!="", | + | Disk quotas for user fenestros (uid 1001): |
+ | Filesystem | ||
+ | / | ||
+ | </ | ||
- | ACTION!=" | + | <WRAP center round important 60%> |
+ | **Important** - This sets a **soft** quota of 8 000 KB and a **hard** quota of 10 000 KB for the fenestros user. When fenestros goes over the soft limit, he/she will recieve a warning message. Going over the hard limit means thet he/she can no longer save files to **/ | ||
+ | </ | ||
- | SUBSYSTEM==" | + | Save and quit the file. |
- | SUBSYSTEM==" | + | |
- | SUBSYSTEM==" | + | |
- | SUBSYSTEM==" | + | |
- | SUBSYSTEM==" | + | |
- | SUBSYSTEM==" | + | |
- | SUBSYSTEM==" | + | |
- | KERNEL==" | + | |
- | SUBSYSTEM==" | + | The command line switches of the **edquota** command are as follows: |
- | SUBSYSTEM==" | + | < |
- | SUBSYSTEM==" | + | [root@centos8 ~]# edquota |
+ | edquota: Usage: | ||
+ | edquota [-rm] [-u] [-F formatname] [-p username] [-f filesystem] username ... | ||
+ | edquota [-rm] -g [-F formatname] [-p groupname] [-f filesystem] groupname ... | ||
+ | edquota [-rm] -P [-F formatname] [-p projectname] [-f filesystem] projectname ... | ||
+ | edquota [-u|g|-P] [-F formatname] [-f filesystem] -t | ||
+ | edquota [-u|g|-P] [-F formatname] [-f filesystem] -T username|groupname|projectname ... | ||
- | SUBSYSTEM==" | + | -u, --user |
- | SUBSYSTEM==" | + | -g, --group |
- | SUBSYSTEM==" | + | -P, --project |
- | SUBSYSTEM==" | + | -r, --remote |
- | SUBSYSTEM==" | + | -m, --no-mixed-pathnames |
- | SUBSYSTEM==" | + | -F, --format=formatname |
+ | -p, --prototype=name copy data from a prototype user/group | ||
+ | | ||
+ | composed only of digits | ||
+ | -f, --filesystem=filesystem | ||
+ | -t, --edit-period | ||
+ | -T, --edit-times | ||
+ | -h, --help | ||
+ | -V, --version | ||
- | SUBSYSTEM==" | + | Bugs to: jack@suse.cz |
- | SUBSYSTEM==" | + | |
- | + | ||
- | SUBSYSTEM==" | + | |
- | OPTIONS+=" | + | |
- | --More-- | + | |
</ | </ | ||
- | Each rule has the following format: | + | <WRAP center round important 60%> |
- | + | **Important** - The procedure is similar in the case that you specify | |
- | KEY, [KEY, ...] NAME [, SYMLINK] | + | </WRAP> |
- | + | ||
- | The Key is a **type=value** pair which uniquely identifies a peripheral. The **type** can be one of the following: | + | |
- | + | ||
- | ^ Type ^ Description ^ Examples ^ | + | |
- | | BUS | Bus type | usb, scsi, ide | | + | |
- | | KERNEL | The default name given to the peripheral by the kernel | hda, ttyUSB0, lp0 | | + | |
- | | SUBSYSTEM | The default sub-system name given by the Kernel, generally identical to the BUS value | usb, scsi | | + | |
- | | DRIVER | The name of the module used by the peripheral | usb-storage | | + | |
- | | ID | The position of the peripheral on its bus | PCI bus id, USB id | | + | |
- | | PLACE | The topological position of a USB oeripheral on its bus. | S/O | | + | |
- | | SYSFS{filename} | The name of the peripheral file in /sys. This file contains the manufacturer' | + | |
- | | PROGRAM | An eventual external program to be called in order to identify the peripheral | S/O | | + | |
- | | RESULT | Value expected from PROGRAM | S/O | | + | |
- | + | ||
- | NAME and SYMLINK are used to tell udev what to do with the peripheral: | + | |
- | + | ||
- | ^ Type ^ Description ^ | + | |
- | | NAME | The name of the peripheral in /dev | | + | |
- | | SYMLINK | The eventual symbolic links that point to NAME | | + | |
- | ====The | + | ====3.3 - The quotaon |
- | To obtain information from udev on a particular peripheral, you can use the **udevadm** command which has replaced the **udevinfo** command available in Red Hat/CentOS 5: | + | Now apply the quotas |
< | < | ||
- | [root@centos8 ~]# udevadm info --query=all -n /dev/sda | + | [root@centos8 ~]# quotaon |
- | P: / | + | |
- | N: sda | + | |
- | S: disk/ | + | |
- | S: disk/ | + | |
- | S: disk/ | + | |
- | S: disk/ | + | |
- | S: disk/ | + | |
- | E: DEVLINKS=/ | + | |
- | E: DEVNAME=/ | + | |
- | E: DEVPATH=/ | + | |
- | E: DEVTYPE=disk | + | |
- | E: ID_ATA=1 | + | |
- | E: ID_ATA_FEATURE_SET_SMART=1 | + | |
- | E: ID_ATA_FEATURE_SET_SMART_ENABLED=1 | + | |
- | E: ID_ATA_SATA=1 | + | |
- | E: ID_ATA_WRITE_CACHE=1 | + | |
- | E: ID_ATA_WRITE_CACHE_ENABLED=1 | + | |
- | E: ID_BUS=ata | + | |
- | E: ID_MODEL=QEMU_HARDDISK | + | |
- | E: ID_MODEL_ENC=QEMU\x20HARDDISK\x20\x20\x20 | + | |
- | E: ID_PART_TABLE_TYPE=dos | + | |
- | E: ID_PART_TABLE_UUID=b39ec5c8 | + | |
- | E: ID_PATH=pci-0000: | + | |
- | E: ID_PATH_TAG=pci-0000_00_07_0-ata-1 | + | |
- | E: ID_REVISION=2.5+ | + | |
- | E: ID_SCSI=1 | + | |
- | E: ID_SCSI_INQUIRY=1 | + | |
- | E: ID_SERIAL=QEMU_HARDDISK_QM00005 | + | |
- | E: ID_SERIAL_SHORT=QM00005 | + | |
- | E: ID_TYPE=disk | + | |
- | E: ID_VENDOR=ATA | + | |
- | E: ID_VENDOR_ENC=ATA\x20\x20\x20\x20\x20 | + | |
- | E: MAJOR=8 | + | |
- | E: MINOR=0 | + | |
- | E: SCSI_IDENT_LUN_ATA=QEMU_HARDDISK_QM00005 | + | |
- | E: SCSI_IDENT_LUN_T10=ATA_QEMU_HARDDISK_QM00005 | + | |
- | E: SCSI_IDENT_LUN_VENDOR=QM00005 | + | |
- | E: SCSI_IDENT_SERIAL=QM00005 | + | |
- | E: SCSI_MODEL=QEMU_HARDDISK | + | |
- | E: SCSI_MODEL_ENC=QEMU\x20HARDDISK\x20\x20\x20 | + | |
- | E: SCSI_REVISION=2.5+ | + | |
- | E: SCSI_TPGS=0 | + | |
- | E: SCSI_TYPE=disk | + | |
- | E: SCSI_VENDOR=ATA | + | |
- | E: SCSI_VENDOR_ENC=ATA\x20\x20\x20\x20\x20 | + | |
- | E: SUBSYSTEM=block | + | |
- | E: TAGS=: | + | |
- | E: USEC_INITIALIZED=8735808 | + | |
</ | </ | ||
- | The command line switches of this command are: | + | The command line switches of the **quotaon** |
< | < | ||
- | [root@centos8 ~]# udevadm | + | [root@centos8 ~]# quotaon |
- | udevadm | + | quotaon: Usage: |
+ | quotaon | ||
+ | quotaon [-guPvp] [-F quotaformat] [-x state] filesys ... | ||
- | Send control commands | + | -a, --all turn quotas on for all filesystems |
+ | -f, --off turn quotas off | ||
+ | -u, --user | ||
+ | -g, --group | ||
+ | -P, --project | ||
+ | -p, --print-state | ||
+ | -x, --xfs-command=cmd | ||
+ | -F, --format=formatname | ||
+ | -v, --verbose | ||
+ | -h, --help | ||
+ | -V, --version | ||
+ | </ | ||
- | Commands: | + | <WRAP center round important 60%> |
- | | + | **important** - To turn **off** quotas, use the **quotaoff** command. |
- | | + | </ |
- | settle | + | |
- | control | + | |
- | monitor | + | |
- | test Test an event run | + | |
- | test-builtin | + | |
- | [root@centos8 ~]# udevadm info --help | + | ====3.4 |
- | udevadm info [OPTIONS] [DEVPATH|FILE] | + | |
- | Query sysfs or the udev database. | + | To see quotas, use the **repquota** command: |
- | | + | < |
- | | + | [root@centos8 ~]# repquota /home |
- | | + | *** Report for user quotas on device /dev/sdc1 |
- | | + | Block grace time: 7days; Inode grace time: 7days |
- | | + | Block limits |
- | | + | User used soft hard grace used soft hard grace |
- | | + | ---------------------------------------------------------------------- |
- | | + | root |
- | | + | trainee |
- | | + | |
- | | + | |
- | | + | |
- | of parent devices | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | -c --cleanup-db | + | |
</ | </ | ||
- | =====The | + | <WRAP center round important 60%> |
+ | **Important** - Note that fenestros is not visible in this list. With RHEL / CentOS, quotas are not visible until the user has connected for the first time. | ||
+ | </ | ||
- | The virtual filesystem | + | The command line switches of the **repquota** command are as follows: |
< | < | ||
- | [root@centos8 ~]# ls -l /sys | + | [root@centos8 ~]# repquota |
- | total 0 | + | repquota: Utility for reporting quotas. |
- | drwxr-xr-x. 2 root root 0 Jul 12 08:15 block | + | Usage: |
- | drwxr-xr-x. 33 root root 0 Jul 12 08:15 bus | + | repquota [-vugsi] [-c|C] [-t|n] [-F quotaformat] [-O (default | xml | csv)] (-a | mntpoint) |
- | drwxr-xr-x. 57 root root 0 Jul 12 08:15 class | + | |
- | drwxr-xr-x. 4 root root 0 Jul 12 08:15 dev | + | -v, --verbose |
- | drwxr-xr-x. 14 root root 0 Jul 12 08:15 devices | + | -u, --user display information about users |
- | drwxr-xr-x. 6 root root 0 Jul 12 08:15 firmware | + | -g, --group |
- | drwxr-xr-x. 9 root root 0 Jul 12 08:15 fs | + | -P, --project |
- | drwxr-xr-x. 2 root root 0 Jul 12 08:15 hypervisor | + | -s, --human-readable |
- | drwxr-xr-x. 15 root root 0 Jul 12 08:15 kernel | + | -t, --truncate-names |
- | drwxr-xr-x. 153 root root 0 Jul 12 08:15 module | + | -p, --raw-grace |
- | drwxr-xr-x. 2 root root 0 Jul 12 08:15 power | + | -n, --no-names |
+ | -i, --no-autofs | ||
+ | -c, --cache | ||
+ | -C, --no-cache | ||
+ | -F, --format=formatname | ||
+ | -O, --output=format | ||
+ | -a, --all | ||
+ | -h, --help | ||
+ | -V, --version | ||
+ | |||
+ | Bugs to jack@suse.cz | ||
</ | </ | ||
- | Each directory contains specific information: | + | ====3.5 - The quota Command==== |
- | * **block** | + | To see quotas for a specific user, use the **quota** command: |
- | * information concerning block devices | + | |
- | * **bus** | + | |
- | * information concerning buses | + | |
- | * **class** | + | |
- | * information concerning classes | + | |
- | * **devices** | + | |
- | * information concerning | + | |
- | * **firmware** | + | |
- | * information concerning APCI | + | |
- | * **module** | + | |
- | * information concerning kernel modules | + | |
- | * **power** | + | |
- | * information concerning power management | + | |
- | * **fs** | + | |
- | | + | |
- | + | ||
- | For example: | + | |
< | < | ||
- | [root@centos | + | [root@centos8 |
- | 2097152 | + | Disk quotas for user fenestros (uid 1001): no limited resources used |
+ | [root@centos8 ~]# su - fenestros | ||
+ | [fenestros@centos8 ~]$ touch test | ||
+ | [fenestros@centos8 ~]$ exit | ||
+ | logout | ||
+ | [root@centos8 ~]# quota fenestros | ||
+ | Disk quotas for user fenestros (uid 1001): | ||
+ | | ||
+ | | ||
</ | </ | ||
- | The figure returned is in sectors. | + | The command line switches of the **quota** command are as follows: |
- | =====LAB | + | < |
+ | [root@centos8 ~]# quota --help | ||
+ | quota: Usage: quota [-guPqvswim] [-l | [-Q | -A]] [-F quotaformat] | ||
+ | quota [-qvswim] [-l | [-Q | -A]] [-F quotaformat] -u username ... | ||
+ | quota [-qvswim] [-l | [-Q | -A]] [-F quotaformat] -g groupname ... | ||
+ | quota [-qvswugPQm] [-F quotaformat] -f filesystem ... | ||
- | ====4.1 - ulimit==== | + | -u, --user |
+ | -g, --group | ||
+ | -P, --project | ||
+ | -q, --quiet | ||
+ | -v, --verbose | ||
+ | -s, --human-readable | ||
+ | --always-resolve | ||
+ | composed of only digits | ||
+ | -w, --no-wrap | ||
+ | -p, --raw-grace | ||
+ | -l, --local-only | ||
+ | -Q, --quiet-refuse | ||
+ | not respond | ||
+ | -i, --no-autofs | ||
+ | -F, --format=formatname | ||
+ | -f, --filesystem-list | ||
+ | -A, --all-nfs | ||
+ | -m, --no-mixed-pathnames | ||
+ | --show-mntpoint | ||
+ | --hide-device | ||
+ | -h, --help | ||
+ | -V, --version | ||
- | Resources available | + | Bugs to: jack@suse.cz |
+ | </ | ||
- | The **ulimit** command manages two limits: | + | ====3.6 - The warnquota Command==== |
- | | + | The **warnquota** command checks user and group disk usage and sends out messages when the **soft** |
- | | + | |
- | The soft limit is the limit imposed on the user whilst the hard limit is the limit that a user can obtain once he has gone over the soft limit. | + | < |
+ | [root@centos8 ~]# which warnquota | ||
+ | / | ||
+ | </ | ||
- | Only root can position a hard limit and only if the limit does not exceed real resource levels. | + | Install |
- | + | ||
- | Root can define limits by editing | + | |
< | < | ||
- | [root@centos8 | + | [root@centos7 |
- | # / | + | |
- | # | + | |
- | #This file sets the resource limits for the users logged in via PAM. | + | |
- | #It does not affect resource limits of the system services. | + | |
- | # | + | |
- | #Also note that configuration files in / | + | |
- | #which are read in alphabetical order, override the settings in this | + | |
- | #file in case the domain is the same or more specific. | + | |
- | #That means for example that setting a limit for wildcard domain here | + | |
- | #can be overriden with a wildcard setting in a config file in the | + | |
- | # | + | |
- | #with a user specific setting in the subdirectory. | + | |
- | # | + | |
- | #Each line describes a limit for a user in the form: | + | |
- | # | + | |
- | #< | + | |
- | # | + | |
- | #Where: | + | |
- | #< | + | |
- | # | + | |
- | # - a group name, with @group syntax | + | |
- | # - the wildcard *, for default entry | + | |
- | # - the wildcard %, can be also used with %group syntax, | + | |
- | # for maxlogin limit | + | |
- | # | + | |
- | #< | + | |
- | # - " | + | |
- | # - " | + | |
- | # | + | |
- | #< | + | |
- | # - core - limits the core file size (KB) | + | |
- | # - data - max data size (KB) | + | |
- | # - fsize - maximum filesize (KB) | + | |
- | # - memlock - max locked-in-memory address space (KB) | + | |
- | # - nofile - max number of open file descriptors | + | |
- | # - rss - max resident set size (KB) | + | |
- | # - stack - max stack size (KB) | + | |
- | # - cpu - max CPU time (MIN) | + | |
- | # - nproc - max number of processes | + | |
- | # - as - address space limit (KB) | + | |
- | # - maxlogins - max number of logins for this user | + | |
- | # - maxsyslogins - max number of logins on the system | + | |
- | # - priority - the priority to run user process with | + | |
- | # - locks - max number of file locks the user can hold | + | |
- | # - sigpending - max number of pending signals | + | |
- | # - msgqueue - max memory used by POSIX message queues (bytes) | + | |
- | # - nice - max nice priority allowed to raise to values: [-20, 19] | + | |
- | # - rtprio - max realtime priority | + | |
- | # | + | |
- | #< | + | |
- | # | + | |
- | + | ||
- | #* | + | |
- | #* | + | |
- | # | + | |
- | # | + | |
- | # | + | |
- | #ftp | + | |
- | # | + | |
- | + | ||
- | # End of file | + | |
- | </ | + | |
- | + | ||
- | <WRAP center round important 60%> | + | |
- | **Important** : The limit can be a number or the word **unlimited**. | + | |
- | </ | + | |
- | + | ||
- | For example if root adds the two following lines to / | + | |
- | + | ||
- | < | + | |
... | ... | ||
- | trainee | ||
- | trainee | ||
- | ... | ||
- | </ | ||
- | |||
- | the number of open files for trainee is limited to 1024. However trainee can increase this limit to 4 096 by using the following command: | ||
- | |||
- | < | ||
- | $ ulimit -n 4096 | ||
</ | </ | ||
- | To see the list of the current limits use the **-a** switch: | + | The command line switches |
< | < | ||
- | [root@centos8 ~]# ulimit | + | [root@centos8 ~]# warnquota |
- | core file size (blocks, | + | warnquota: Usage: |
- | data seg size | + | |
- | scheduling priority | + | |
- | file size | + | |
- | pending signals | + | |
- | max locked memory | + | |
- | max memory size | + | |
- | open files (-n) 1024 | + | |
- | pipe size (512 bytes, -p) 8 | + | |
- | POSIX message queues | + | |
- | real-time priority | + | |
- | stack size (kbytes, -s) 8192 | + | |
- | cpu time | + | |
- | max user processes | + | |
- | virtual memory | + | |
- | file locks (-x) unlimited | + | |
- | </ | + | |
- | The command line switches | + | -u, --user |
+ | -g, --group | ||
+ | -s, --human-readable | ||
+ | -i, --no-autofs | ||
+ | -d, --no-details | ||
+ | -F, --format=formatname | ||
+ | -c, --config=config-file | ||
+ | -q, --quota-tab=quotatab-file | ||
+ | -a, --admins-file=admins-file | ||
+ | -h, --help | ||
+ | -v, --version | ||
- | < | + | warnquota: Bugs to jack@suse.cz |
- | [root@centos8 ~]# help ulimit | + | |
- | ulimit: ulimit [-SHabcdefiklmnpqrstuvxPT] [limit] | + | |
- | Modify shell resource limits. | + | |
- | + | ||
- | Provides control over the resources available | + | |
- | it creates, on systems that allow such control. | + | |
- | + | ||
- | Options: | + | |
- | -S use the `soft' resource limit | + | |
- | -H use the `hard' resource limit | + | |
- | -a all current limits are reported | + | |
- | -b the socket buffer size | + | |
- | -c the maximum size of core files created | + | |
- | -d the maximum size of a process' | + | |
- | -e the maximum scheduling priority (`nice' | + | |
- | -f the maximum size of files written by the shell and its children | + | |
- | -i the maximum number of pending signals | + | |
- | -k the maximum number of kqueues allocated for this process | + | |
- | -l the maximum size a process may lock into memory | + | |
- | -m the maximum resident set size | + | |
- | -n the maximum number of open file descriptors | + | |
- | -p the pipe buffer size | + | |
- | -q the maximum number of bytes in POSIX message queues | + | |
- | -r the maximum real-time scheduling priority | + | |
- | -s the maximum stack size | + | |
- | -t the maximum amount of cpu time in seconds | + | |
- | -u the maximum number of user processes | + | |
- | -v the size of virtual memory | + | |
- | -x the maximum number of file locks | + | |
- | -P the maximum number of pseudoterminals | + | |
- | -T the maximum number of threads | + | |
- | + | ||
- | Not all options are available on all platforms. | + | |
- | + | ||
- | If LIMIT is given, it is the new value of the specified resource; the | + | |
- | special LIMIT values `soft', | + | |
- | current soft limit, the current hard limit, and no limit, respectively. | + | |
- | Otherwise, the current value of the specified resource is printed. | + | |
- | no option is given, then -f is assumed. | + | |
- | + | ||
- | Values are in 1024-byte increments, except for -t, which is in seconds, | + | |
- | -p, which is in increments of 512 bytes, and -u, which is an unscaled | + | |
- | number of processes. | + | |
- | + | ||
- | Exit Status: | + | |
- | Returns success unless an invalid option is supplied or an error occurs. | + | |
</ | </ | ||
----- | ----- | ||
- | < | + | Copyright © 2022 Hugh Norris. |
- | <div align=" | + | |
- | Copyright © 2021 Hugh Norris. | + | |
- | </ | + |