Niveau : Admin Junior | Numéro de la Leçon | Dernière Modification |
---|---|---|
2/4 | <progrecss 11/12 style=inline /> | 2020/01/30 03:28 |
Dans l'ordinateur les périphériques sont reliés à un contrôleur qui communique avec le processeur à l'aide d'un bus. Le contrôleur ainsi que les périphériques nécessitent des pilotes. Sous Linux, les pilotes sont généralement fournis sous la forme d'un module. Chaque périphérique est représenté par un fichier spécial dans le répertoire /dev et c'est dans ce fichier que le système trouve les informations nécessaires pour s'adresser au pilote.
Consultez le contenu du répertoire /dev :
opensuse:~ # ls -l /dev total 0 drwxr-xr-x 2 root root 60 Apr 9 14:54 .mount drwxr-xr-x 3 root root 60 Apr 9 14:54 .sysconfig drwxr-xr-x 7 root root 160 Apr 9 14:55 .udev crw-rw----+ 1 root audio 14, 12 Apr 9 14:55 adsp crw-rw----+ 1 root audio 14, 4 Apr 9 14:55 audio crw------- 1 root root 10, 235 Apr 9 14:54 autofs drwxr-xr-x 2 root root 140 Apr 9 14:54 block prw------- 1 root root 0 Apr 9 14:55 bootsplash drwxr-xr-x 2 root root 80 Apr 9 14:54 bsg crw------- 1 root root 10, 234 Apr 9 14:54 btrfs-control drwxr-xr-x 3 root root 60 Apr 9 14:54 bus lrwxrwxrwx 1 root root 3 Apr 9 14:54 cdrom -> sr0 drwxr-xr-x 2 root root 3020 Apr 9 15:22 char crw------- 1 root root 5, 1 Apr 9 14:55 console lrwxrwxrwx 1 root root 11 Apr 9 14:54 core -> /proc/kcore drwxr-xr-x 3 root root 80 Apr 9 14:54 cpu crw------- 1 root root 10, 62 Apr 9 14:54 cpu_dma_latency drwxr-xr-x 5 root root 100 Apr 9 14:54 disk drwxr-xr-x 2 root root 60 Apr 9 14:55 dri crw-rw----+ 1 root audio 14, 3 Apr 9 14:55 dsp lrwxrwxrwx 1 root root 3 Apr 9 14:54 dvd -> sr0 crw-rw---- 1 root video 29, 0 Apr 9 14:54 fb0 lrwxrwxrwx 1 root root 13 Apr 9 14:54 fd -> /proc/self/fd crw-rw-rw- 1 root root 1, 7 Apr 9 14:54 full crw-rw-rw- 1 root root 10, 229 Apr 9 15:22 fuse crw------- 1 root root 252, 0 Apr 9 14:54 hidraw0 crw------- 1 root root 10, 228 Apr 9 14:54 hpet prw------- 1 root root 0 Apr 9 14:54 initctl drwxr-xr-x 4 root root 300 Apr 9 14:54 input crw-r----- 1 root kmem 1, 2 Apr 9 14:54 kmem crw------- 1 root root 1, 11 Apr 9 14:54 kmsg srw-rw-rw- 1 root root 0 Apr 9 14:55 log brw-rw---- 1 root disk 7, 0 Apr 9 14:54 loop0 brw-rw---- 1 root disk 7, 1 Apr 9 14:54 loop1 brw-rw---- 1 root disk 7, 2 Apr 9 14:54 loop2 brw-rw---- 1 root disk 7, 3 Apr 9 14:54 loop3 brw-rw---- 1 root disk 7, 4 Apr 9 14:54 loop4 brw-rw---- 1 root disk 7, 5 Apr 9 14:54 loop5 brw-rw---- 1 root disk 7, 6 Apr 9 14:54 loop6 brw-rw---- 1 root disk 7, 7 Apr 9 14:54 loop7 drwxr-xr-x 2 root root 60 Apr 9 14:54 mapper crw------- 1 root root 10, 227 Apr 9 14:54 mcelog crw-r----- 1 root kmem 1, 1 Apr 9 14:54 mem crw-rw----+ 1 root audio 14, 0 Apr 9 14:55 mixer drwxr-xr-x 2 root root 60 Apr 9 14:54 net crw------- 1 root root 10, 61 Apr 9 14:54 network_latency crw------- 1 root root 10, 60 Apr 9 14:54 network_throughput crw-rw-rw- 1 root root 1, 3 Apr 9 14:54 null crw-r----- 1 root kmem 10, 144 Apr 9 14:54 nvram crw------- 1 root root 1, 12 Apr 9 14:54 oldmem crw-r----- 1 root kmem 1, 4 Apr 9 14:54 port crw------- 1 root root 108, 0 Apr 9 14:54 ppp crw------- 1 root root 10, 1 Apr 9 14:54 psaux crw-rw-rw- 1 root tty 5, 2 Apr 9 15:24 ptmx drwxr-xr-x 2 root root 0 Apr 9 14:54 pts crw-rw-rw- 1 root root 1, 8 Apr 9 14:54 random lrwxrwxrwx 1 root root 4 Apr 9 14:54 root -> sda2 lrwxrwxrwx 1 root root 4 Apr 9 14:54 rtc -> rtc0 crw------- 1 root root 254, 0 Apr 9 14:54 rtc0 lrwxrwxrwx 1 root root 3 Apr 9 14:54 scd0 -> sr0 brw-rw---- 1 root disk 8, 0 Apr 9 14:54 sda brw-rw---- 1 root disk 8, 1 Apr 9 14:54 sda1 brw-rw---- 1 root disk 8, 2 Apr 9 14:54 sda2 brw-rw---- 1 root disk 8, 3 Apr 9 14:54 sda3 crw-rw---- 1 root disk 21, 0 Apr 9 14:54 sg0 crw-rw---- 1 root cdrom 21, 1 Apr 9 14:54 sg1 drwxrwxrwt 2 root root 180 Apr 9 15:23 shm crw------- 1 root root 10, 231 Apr 9 14:54 snapshot drwxr-xr-x 3 root root 180 Apr 9 14:55 snd brw-rw----+ 1 root cdrom 11, 0 Apr 9 14:54 sr0 lrwxrwxrwx 1 root root 4 Apr 9 14:54 stderr -> fd/2 lrwxrwxrwx 1 root root 4 Apr 9 14:54 stdin -> fd/0 lrwxrwxrwx 1 root root 4 Apr 9 14:54 stdout -> fd/1 crw-rw-rw- 1 root tty 5, 0 Apr 9 14:54 tty crw--w---- 1 root root 4, 0 Apr 9 14:54 tty0 crw-rw---- 1 root tty 4, 1 Apr 9 14:55 tty1 crw--w---- 1 root tty 4, 10 Apr 9 15:22 tty10 crw--w---- 1 root tty 4, 11 Apr 9 14:54 tty11 crw--w---- 1 root tty 4, 12 Apr 9 14:54 tty12 crw--w---- 1 root tty 4, 13 Apr 9 14:54 tty13 crw--w---- 1 root tty 4, 14 Apr 9 14:54 tty14 crw--w---- 1 root tty 4, 15 Apr 9 14:54 tty15 crw--w---- 1 root tty 4, 16 Apr 9 14:54 tty16 crw--w---- 1 root tty 4, 17 Apr 9 14:54 tty17 crw--w---- 1 root tty 4, 18 Apr 9 14:54 tty18 crw--w---- 1 root tty 4, 19 Apr 9 14:54 tty19 crw-rw---- 1 root tty 4, 2 Apr 9 14:55 tty2 crw--w---- 1 root tty 4, 20 Apr 9 14:54 tty20 crw--w---- 1 root tty 4, 21 Apr 9 14:54 tty21 crw--w---- 1 root tty 4, 22 Apr 9 14:54 tty22 crw--w---- 1 root tty 4, 23 Apr 9 14:54 tty23 crw--w---- 1 root tty 4, 24 Apr 9 14:54 tty24 crw--w---- 1 root tty 4, 25 Apr 9 14:54 tty25 crw--w---- 1 root tty 4, 26 Apr 9 14:54 tty26 crw--w---- 1 root tty 4, 27 Apr 9 14:54 tty27 crw--w---- 1 root tty 4, 28 Apr 9 14:54 tty28 crw--w---- 1 root tty 4, 29 Apr 9 14:54 tty29 crw-rw---- 1 root tty 4, 3 Apr 9 14:55 tty3 crw--w---- 1 root tty 4, 30 Apr 9 14:54 tty30 crw--w---- 1 root tty 4, 31 Apr 9 14:54 tty31 crw--w---- 1 root tty 4, 32 Apr 9 14:54 tty32 crw--w---- 1 root tty 4, 33 Apr 9 14:54 tty33 crw--w---- 1 root tty 4, 34 Apr 9 14:54 tty34 crw--w---- 1 root tty 4, 35 Apr 9 14:54 tty35 crw--w---- 1 root tty 4, 36 Apr 9 14:54 tty36 crw--w---- 1 root tty 4, 37 Apr 9 14:54 tty37 crw--w---- 1 root tty 4, 38 Apr 9 14:54 tty38 crw--w---- 1 root tty 4, 39 Apr 9 14:54 tty39 crw-rw---- 1 root tty 4, 4 Apr 9 14:55 tty4 crw--w---- 1 root tty 4, 40 Apr 9 14:54 tty40 crw--w---- 1 root tty 4, 41 Apr 9 14:54 tty41 crw--w---- 1 root tty 4, 42 Apr 9 14:54 tty42 crw--w---- 1 root tty 4, 43 Apr 9 14:54 tty43 crw--w---- 1 root tty 4, 44 Apr 9 14:54 tty44 crw--w---- 1 root tty 4, 45 Apr 9 14:54 tty45 crw--w---- 1 root tty 4, 46 Apr 9 14:54 tty46 crw--w---- 1 root tty 4, 47 Apr 9 14:54 tty47 crw--w---- 1 root tty 4, 48 Apr 9 14:54 tty48 crw--w---- 1 root tty 4, 49 Apr 9 14:54 tty49 crw-rw---- 1 root tty 4, 5 Apr 9 14:55 tty5 crw--w---- 1 root tty 4, 50 Apr 9 14:54 tty50 crw--w---- 1 root tty 4, 51 Apr 9 14:54 tty51 crw--w---- 1 root tty 4, 52 Apr 9 14:54 tty52 crw--w---- 1 root tty 4, 53 Apr 9 14:54 tty53 crw--w---- 1 root tty 4, 54 Apr 9 14:54 tty54 crw--w---- 1 root tty 4, 55 Apr 9 14:54 tty55 crw--w---- 1 root tty 4, 56 Apr 9 14:54 tty56 crw--w---- 1 root tty 4, 57 Apr 9 14:54 tty57 crw--w---- 1 root tty 4, 58 Apr 9 14:54 tty58 crw--w---- 1 root tty 4, 59 Apr 9 14:54 tty59 crw-rw---- 1 root tty 4, 6 Apr 9 14:55 tty6 crw--w---- 1 root tty 4, 60 Apr 9 14:54 tty60 crw--w---- 1 root tty 4, 61 Apr 9 14:54 tty61 crw--w---- 1 root tty 4, 62 Apr 9 14:54 tty62 crw--w---- 1 root tty 4, 63 Apr 9 14:54 tty63 crw--w---- 1 root root 4, 7 Apr 9 14:54 tty7 crw--w---- 1 root tty 4, 8 Apr 9 14:54 tty8 crw--w---- 1 root tty 4, 9 Apr 9 14:54 tty9 crw-rw---- 1 root dialout 4, 64 Apr 9 14:54 ttyS0 crw-rw---- 1 root dialout 4, 65 Apr 9 14:54 ttyS1 crw-rw---- 1 root dialout 4, 66 Apr 9 14:54 ttyS2 crw-rw---- 1 root dialout 4, 67 Apr 9 14:54 ttyS3 crw-rw---- 1 root dialout 4, 68 Apr 9 14:54 ttyS4 crw-rw---- 1 root dialout 4, 69 Apr 9 14:54 ttyS5 crw-rw---- 1 root dialout 4, 70 Apr 9 14:54 ttyS6 crw-rw---- 1 root dialout 4, 71 Apr 9 14:54 ttyS7 crw------- 1 root root 10, 223 Apr 9 14:54 uinput crw-rw-rw- 1 root root 1, 9 Apr 9 14:54 urandom crw-rw---- 1 root root 10, 59 Apr 9 14:54 vboxguest crw-rw----+ 1 root root 10, 58 Apr 9 14:54 vboxuser crw-rw---- 1 root tty 7, 0 Apr 9 14:54 vcs crw-rw---- 1 root tty 7, 1 Apr 9 14:54 vcs1 crw-rw---- 1 root tty 7, 10 Apr 9 14:54 vcs10 crw-rw---- 1 root tty 7, 2 Apr 9 14:55 vcs2 crw-rw---- 1 root tty 7, 3 Apr 9 14:55 vcs3 crw-rw---- 1 root tty 7, 4 Apr 9 14:55 vcs4 crw-rw---- 1 root tty 7, 5 Apr 9 14:55 vcs5 crw-rw---- 1 root tty 7, 6 Apr 9 14:55 vcs6 crw-rw---- 1 root tty 7, 7 Apr 9 14:55 vcs7 crw-rw---- 1 root tty 7, 128 Apr 9 14:54 vcsa crw-rw---- 1 root tty 7, 129 Apr 9 14:54 vcsa1 crw-rw---- 1 root tty 7, 138 Apr 9 14:54 vcsa10 crw-rw---- 1 root tty 7, 130 Apr 9 14:55 vcsa2 crw-rw---- 1 root tty 7, 131 Apr 9 14:55 vcsa3 crw-rw---- 1 root tty 7, 132 Apr 9 14:55 vcsa4 crw-rw---- 1 root tty 7, 133 Apr 9 14:55 vcsa5 crw-rw---- 1 root tty 7, 134 Apr 9 14:55 vcsa6 crw-rw---- 1 root tty 7, 135 Apr 9 14:55 vcsa7 crw------- 1 root root 10, 63 Apr 9 14:54 vga_arbiter pr-------- 1 trainee tty 0 Apr 9 15:22 xconsole crw-rw-rw- 1 root root 1, 5 Apr 9 14:54 zero
On peut noter dans la sortie de la commande que certains fichiers sont de type bloc (b), tandis que d'autre sont de type caractère (c).
... brw-rw---- 1 root disk 8, 1 Apr 9 14:54 sda1 ... crw-rw-rw- 1 root tty 5, 0 Apr 9 14:54 tty ...
La différence entre les deux repose sur le type de communication entre le système et le module. Dans le premier cas le système accède au périphérique par des coordonnées du bloc de données sur le support tandis que dans le deuxième cas la communication d'échange de données se fait octet par octet sans utiliser des tampons.
Les deux informations clefs du fichier spécial sont situées à la place de la taille d'un fichier normal et se nomment le majeur et le mineur :
Cette commande vous renseigne sur les adaptateurs reliés aux bus PCI, AGP et PCI express :
opensuse:~ # lspci 00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02) 00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II] 00:01.1 IDE interface: Intel Corporation 82371AB/EB/MB PIIX4 IDE (rev 01) 00:02.0 VGA compatible controller: InnoTek Systemberatung GmbH VirtualBox Graphics Adapter 00:03.0 Ethernet controller: Intel Corporation 82540EM Gigabit Ethernet Controller (rev 02) 00:04.0 System peripheral: InnoTek Systemberatung GmbH VirtualBox Guest Service 00:05.0 Multimedia audio controller: Intel Corporation 82801AA AC'97 Audio Controller (rev 01) 00:06.0 USB Controller: Apple Computer Inc. KeyLargo/Intrepid USB 00:07.0 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 08) 00:0b.0 USB Controller: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) USB2 EHCI Controller 00:0d.0 SATA controller: Intel Corporation 82801HBM/HEM (ICH8M/ICH8M-E) SATA AHCI Controller (rev 02)
Pour obtenir de l'information sur un adaptateur spécifique, il convient d'utiliser la même commande avec l'option -v en spécifiant l'identifiant concerné :
opensuse:~ # lspci -v -s 00:03.0 00:03.0 Ethernet controller: Intel Corporation 82540EM Gigabit Ethernet Controller (rev 02) Subsystem: Intel Corporation PRO/1000 MT Desktop Adapter Flags: bus master, 66MHz, medium devsel, latency 64, IRQ 19 Memory at f0000000 (32-bit, non-prefetchable) [size=128K] I/O ports at d010 [size=8] Capabilities: [dc] Power Management version 2 Capabilities: [e4] PCI-X non-bridge device Kernel driver in use: e1000
ou :
opensuse:~ # lspci -vv -s 00:03.0 00:03.0 Ethernet controller: Intel Corporation 82540EM Gigabit Ethernet Controller (rev 02) Subsystem: Intel Corporation PRO/1000 MT Desktop Adapter Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx- Status: Cap+ 66MHz+ UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx- Latency: 64 (63750ns min) Interrupt: pin A routed to IRQ 19 Region 0: Memory at f0000000 (32-bit, non-prefetchable) [size=128K] Region 2: I/O ports at d010 [size=8] Capabilities: [dc] Power Management version 2 Flags: PMEClk- DSI+ D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-) Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME- Capabilities: [e4] PCI-X non-bridge device Command: DPERE- ERO+ RBC=512 OST=1 Status: Dev=ff:1f.0 64bit- 133MHz- SCD- USC- DC=simple DMMRBC=2048 DMOST=1 DMCRS=8 RSCEM- 266MHz- 533MHz- Kernel driver in use: e1000
Les options de cette commande sont :
opensuse:~ # lspci --help lspci: invalid option -- '-' Usage: lspci [<switches>] Basic display modes: -mm Produce machine-readable output (single -m for an obsolete format) -t Show bus tree Display options: -v Be verbose (-vv for very verbose) -k Show kernel drivers handling each device -x Show hex-dump of the standard part of the config space -xxx Show hex-dump of the whole config space (dangerous; root only) -xxxx Show hex-dump of the 4096-byte extended config space (root only) -b Bus-centric view (addresses and IRQ's as seen by the bus) -D Always show domain numbers Resolving of device ID's to names: -n Show numeric ID's -nn Show both textual and numeric ID's (names & numbers) -q Query the PCI ID database for unknown ID's via DNS -qq As above, but re-query locally cached entries -Q Query the PCI ID database for all ID's via DNS Selection of devices: -s [[[[<domain>]:]<bus>]:][<slot>][.[<func>]] Show only devices in selected slots -d [<vendor>]:[<device>] Show only devices with specified ID's Other options: -i <file> Use specified ID database instead of /usr/share/pci.ids.gz -p <file> Look up kernel modules in a given file instead of default modules.pcimap -M Enable `bus mapping' mode (dangerous; root only) PCI access options: -A <method> Use the specified PCI access method (see `-A help' for a list) -O <par>=<val> Set PCI access parameter (see `-O help' for a list) -G Enable PCI access debugging -H <mode> Use direct hardware access (<mode> = 1 or 2) -F <file> Read PCI configuration dump from a given file
Cette commande vous renseigne sur les adaptateurs reliés au bus usb :
opensuse:~ # lsusb Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 002 Device 002: ID 80ee:0021 VirtualBox USB Tablet
Pour obtenir de l'information sur un périphérique usb, il convient d'utiliser la même commande avec l'option -d en spécifiant l'identifiant concerné.
Les options de cette commande sont :
opensuse:~ # lsusb --help lsusb: unrecognized option '--help' Usage: lsusb [options]... List USB devices -v, --verbose Increase verbosity (show descriptors) -s [[bus]:][devnum] Show only devices with specified device and/or bus numbers (in decimal) -d vendor:[product] Show only devices with the specified vendor and product ID numbers (in hexadecimal) -D device Selects which device lsusb will examine -t Dump the physical USB device hierarchy as a tree -V, --version Show version of program
La commande dmidecode lit la table DMI (Desktop Management Interface) aussi appelée SMBIOS (System Management BIOS) et fourni les informations sur :
opensuse:~ # dmidecode # dmidecode 2.11 SMBIOS 2.5 present. 5 structures occupying 352 bytes. Table at 0x000E1000. Handle 0x0000, DMI type 0, 20 bytes BIOS Information Vendor: innotek GmbH Version: VirtualBox Release Date: 12/01/2006 Address: 0xE0000 Runtime Size: 128 kB ROM Size: 128 kB Characteristics: ISA is supported PCI is supported Boot from CD is supported Selectable boot is supported 8042 keyboard services are supported (int 9h) CGA/mono video services are supported (int 10h) ACPI is supported Handle 0x0001, DMI type 1, 27 bytes System Information Manufacturer: innotek GmbH Product Name: VirtualBox Version: 1.2 Serial Number: 0 UUID: C57E5C33-DEF8-4555-80AC-312DB181420D Wake-up Type: Power Switch SKU Number: Not Specified Family: Virtual Machine Handle 0x0003, DMI type 126, 13 bytes Inactive Handle 0x0002, DMI type 126, 7 bytes Inactive Handle 0xFEFF, DMI type 127, 147 bytes End Of Table
Les options de cette commande sont :
opensuse:~ # dmidecode --help Usage: dmidecode [OPTIONS] Options are: -d, --dev-mem FILE Read memory from device FILE (default: /dev/mem) -h, --help Display this help text and exit -q, --quiet Less verbose output -s, --string KEYWORD Only display the value of the given DMI string -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 Display the version and exit
Le répertoire /proc contient des fichiers et des répertoires virtuels. Le contenu de ces fichiers est créé dynamiquement lors de la consultation. Seul root peut consulter la totalité des informations dans le répertoire /proc.
opensuse:~ # ls /proc 1 21 3553 4084 6356 6427 asound kcore slabinfo 10 22 36 540 6358 6429 buddyinfo key-users softirqs 11 23 3765 550 6360 6448 bus kmsg splash 1136 2374 3793 575 6362 6450 cgroups kpagecount stat 12 24 38 5783 6364 6495 cmdline kpageflags swaps 1238 247 3831 6 6368 6499 config.gz latency_stats sys 13 25 3840 6094 6376 6501 cpuinfo loadavg sysrq-trigger 1301 2504 3862 6118 6378 6503 crypto locks sysvipc 1313 253 388 6204 6381 6545 devices mdstat timer_list 14 2540 389 6213 6388 6631 diskstats meminfo timer_stats 15 2549 39 6218 6395 6660 dma misc tty 16 2552 3931 6260 6396 6663 dri modules uptime 1682 26 3960 6261 6397 6664 driver mounts version 1698 27 3961 6266 6404 6675 execdomains mtrr vmallocinfo 17 3 3962 6277 6406 6679 fb net vmstat 1728 31 4 6280 6407 6876 filesystems pagetypeinfo zoneinfo 18 32 40 6288 6412 7 fs partitions 1829 322 4079 6291 6417 8 interrupts reserve_info 19 33 4080 6297 6418 9 iomem sched_debug 1970 34 4081 6349 6419 962 ioports schedstat 2 3484 4082 6350 6422 971 irq scsi 20 35 4083 6354 6423 acpi kallsyms self
Ce répertoire contient des répertoires dans lesquels se trouvent des informations sur la capacité, le type et la géométrie des disques.
Ce répertoire contient des informations sur la gestion de l'énérgie, les températures, les vitesses de ventilateurs, la charge des batteries.
Ce répertoire contient un sous-répertoire par bus.
Ce répertoire contient des informations sur le réseau.
Ce répertoire contient des paramètres du noyau. Certains des fichiers dans ce répertoire sont accessibles en écriture par root en temps réel. Par exemple pour éviter des attaques réseau DoS utilisant la commande ping, saisissez la commande suivante :
# echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all [Entrée]
Cette commande a pour résultat d'ignorer les reqûetes ping.
Les fichiers dans le répertoire /proc/sys peuvent être administrés par la commande sysctl en temps réel.
La commande sysctl applique les règles consignés dans le fichier /etc/sysctl.conf au démarrage de la machine.
Saisissez la commande :
opensuse:~ # cat /etc/sysctl.conf # Disable response to broadcasts. # You don't want yourself becoming a Smurf amplifier. net.ipv4.icmp_echo_ignore_broadcasts = 1 # enable route verification on all interfaces net.ipv4.conf.all.rp_filter = 1 # disable IPv6 completely # net.ipv6.conf.all.disable_ipv6 = 1 # enable IPv6 forwarding #net.ipv6.conf.all.forwarding = 1 # increase the number of possible inotify(7) watches fs.inotify.max_user_watches = 65536 # avoid deleting secondary IPs on deleting the primary IP net.ipv4.conf.default.promote_secondaries = 1 net.ipv4.conf.all.promote_secondaries = 1
Les options de la commande sysctl sont :
opensuse:~ # sysctl --help usage: sysctl [-n] [-e] variable ... sysctl [-n] [-e] [-q] -w variable=value ... sysctl [-n] [-e] -a sysctl [-n] [-e] [-q] -p <file> (default /etc/sysctl.conf) sysctl [-n] [-e] -A
<note important> Consultez la page de la traduction du manuel de sysctl ici pour comprendre la commande. </note>
opensuse:~ # cat /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 37 model name : Intel(R) Core(TM) i5 CPU M 480 @ 2.67GHz stepping : 5 cpu MHz : 2648.621 cache size : 6144 KB fdiv_bug : no hlt_bug : no f00f_bug : no coma_bug : no fpu : yes fpu_exception : yes cpuid level : 5 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 syscall nx lm constant_tsc up pni monitor ssse3 lahf_lm bogomips : 5297.24 clflush size : 64 cache_alignment : 64 address sizes : 36 bits physical, 48 bits virtual power management:
opensuse:~ # cat /proc/interrupts CPU0 0: 134 IO-APIC-edge timer 1: 506 IO-APIC-edge i8042 8: 1 IO-APIC-edge rtc0 9: 0 IO-APIC-fasteoi acpi 12: 2407 IO-APIC-edge i8042 14: 39096 IO-APIC-edge ata_piix 15: 1855 IO-APIC-edge ata_piix 19: 2255 IO-APIC-fasteoi ehci_hcd:usb1, eth0 20: 33353 IO-APIC-fasteoi vboxguest 21: 699 IO-APIC-fasteoi ahci, Intel 82801AA-ICH 22: 32 IO-APIC-fasteoi ohci_hcd:usb2 NMI: 0 Non-maskable interrupts LOC: 270573 Local timer interrupts SPU: 0 Spurious interrupts PMI: 0 Performance monitoring interrupts IWI: 0 IRQ work interrupts RES: 0 Rescheduling interrupts CAL: 0 Function call interrupts TLB: 0 TLB shootdowns TRM: 0 Thermal event interrupts THR: 0 Threshold APIC interrupts MCE: 0 Machine check exceptions MCP: 8 Machine check polls ERR: 0 MIS: 0
opensuse:~ # cat /proc/dma 4: cascade
opensuse:~ # cat /proc/ioports 0000-001f : dma1 0020-0021 : pic1 0040-0043 : timer0 0050-0053 : timer1 0060-0060 : keyboard 0064-0064 : keyboard 0070-0071 : rtc_cmos 0070-0071 : rtc0 0080-008f : dma page reg 00a0-00a1 : pic2 00c0-00df : dma2 00f0-00ff : fpu 0170-0177 : 0000:00:01.1 0170-0177 : ata_piix 01f0-01f7 : 0000:00:01.1 01f0-01f7 : ata_piix 0376-0376 : 0000:00:01.1 0376-0376 : ata_piix 03c0-03df : vesafb 03f6-03f6 : 0000:00:01.1 03f6-03f6 : ata_piix 0cf8-0cff : PCI conf1 4000-4003 : ACPI PM1a_EVT_BLK 4004-4005 : ACPI PM1a_CNT_BLK 4008-400b : ACPI PM_TMR 4020-4021 : ACPI GPE0_BLK d000-d00f : 0000:00:01.1 d000-d00f : ata_piix d010-d017 : 0000:00:03.0 d010-d017 : e1000 d020-d03f : 0000:00:04.0 d100-d1ff : 0000:00:05.0 d100-d1ff : Intel 82801AA-ICH d200-d23f : 0000:00:05.0 d200-d23f : Intel 82801AA-ICH d240-d247 : 0000:00:0d.0 d240-d247 : ahci d250-d257 : 0000:00:0d.0 d250-d257 : ahci d260-d26f : 0000:00:0d.0 d260-d26f : ahci
opensuse:~ # cat /proc/devices Character devices: 1 mem 4 /dev/vc/0 4 tty 4 ttyS 5 /dev/tty 5 /dev/console 5 /dev/ptmx 7 vcs 10 misc 13 input 14 sound/mixer 14 sound/dsp 14 sound/audio 14 sound/adsp 21 sg 29 fb 99 ppdev 116 alsa 128 ptm 136 pts 180 usb 189 usb_device 202 cpu/msr 226 drm 252 hidraw 253 bsg 254 rtc Block devices: 259 blkext 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
opensuse:~ # cat /proc/modules fuse 72011 2 - Live 0xf81b5000 ip6t_LOG 7940 5 - Live 0xf8117000 xt_tcpudp 3052 2 - Live 0xf7d38000 xt_pkttype 960 3 - Live 0xf7d32000 ipt_LOG 7845 5 - Live 0xf7d20000 xt_limit 1753 10 - Live 0xf7ceb000 af_packet 20330 0 - Live 0xf7cb8000 vboxsf 40932 0 - Live 0xf7c86000 vboxvideo 1276 1 - Live 0xf79fe000 drm 191946 2 vboxvideo, Live 0xf8237000 binfmt_misc 7069 1 - Live 0xf7c72000 mperf 1271 0 - Live 0xf7cbf000 snd_pcm_oss 48271 0 - Live 0xf7d3a000 snd_mixer_oss 17521 1 snd_pcm_oss, Live 0xf7c91000 snd_seq 57777 0 - Live 0xf7c57000 snd_seq_device 6678 1 snd_seq, Live 0xf7a7d000 edd 8752 0 - Live 0xf7a3e000 ip6t_REJECT 4192 3 - Live 0xf81f3000 nf_conntrack_ipv6 8286 3 - Live 0xf81e6000 nf_defrag_ipv6 9434 1 nf_conntrack_ipv6, Live 0xf81d8000 ip6table_raw 1203 1 - Live 0xf81c8000 xt_NOTRACK 864 4 - Live 0xf81b2000 ipt_REJECT 2200 3 - Live 0xf81a3000 iptable_raw 1294 1 - Live 0xf8196000 iptable_filter 1466 1 - Live 0xf8189000 ip6table_mangle 1636 0 - Live 0xf817f000 nf_conntrack_netbios_ns 1366 0 - Live 0xf8175000 nf_conntrack_ipv4 8584 3 - Live 0xf8168000 nf_defrag_ipv4 1281 1 nf_conntrack_ipv4, Live 0xf815b000 ip_tables 13128 2 iptable_raw,iptable_filter, Live 0xf814d000 xt_conntrack 2480 6 - Live 0xf813f000 nf_conntrack 75967 5 nf_conntrack_ipv6,xt_NOTRACK,nf_conntrack_netbios_ns,nf_conntrack_ipv4,xt_conntrack, Live 0xf812a000 ip6table_filter 1375 1 - Live 0xf7cef000 ip6_tables 13404 4 ip6t_LOG,ip6table_raw,ip6table_mangle,ip6table_filter, Live 0xf7d13000 x_tables 18727 16 ip6t_LOG,xt_tcpudp,xt_pkttype,ipt_LOG,xt_limit,ip6t_REJECT,ip6table_raw,xt_NOTRACK,ipt_REJECT,iptable_raw,iptable_filter,ip6table_mangle,ip_tables,xt_conntrack,ip6table_filter,ip6_tables, Live 0xf7cdc000 dm_mod 76266 0 - Live 0xf80f8000 snd_intel8x0 27702 2 - Live 0xf7c9a000 snd_ac97_codec 106769 1 snd_intel8x0, Live 0xf7cf6000 ppdev 7883 0 - Live 0xf7a22000 parport_pc 33763 0 - Live 0xf7a2c000 ac97_bus 1082 1 snd_ac97_codec, Live 0xf7a15000 snd_pcm 88841 3 snd_pcm_oss,snd_intel8x0,snd_ac97_codec, Live 0xf8573000 vboxguest 208231 6 vboxsf, Live 0xf8508000 snd_timer 22055 2 snd_seq,snd_pcm, Live 0xf84fc000 parport 34550 2 ppdev,parport_pc, Live 0xf84ec000 joydev 9578 0 - Live 0xf84ca000 snd 67246 12 snd_pcm_oss,snd_mixer_oss,snd_seq,snd_seq_device,snd_intel8x0,snd_ac97_codec,snd_pcm,snd_timer, Live 0xf84af000 sr_mod 15048 0 - Live 0xf847a000 e1000 139787 0 - Live 0xf8445000 battery 10066 0 - Live 0xf840b000 cdrom 38437 1 sr_mod, Live 0xf83fb000 sg 28446 0 - Live 0xf83e7000 button 5497 0 - Live 0xf7d23000 ac 3227 0 - Live 0xf7d1a000 i2c_piix4 10342 0 - Live 0xf7cf1000 pcspkr 1662 0 - Live 0xf7ce4000 soundcore 7270 1 snd, Live 0xf7cd8000 snd_page_alloc 8121 2 snd_intel8x0,snd_pcm, Live 0xf7ccb000 fan 2575 0 - Live 0xf7c69000 processor 36507 0 - Live 0xf7a42000 thermal 13154 0 - Live 0xf7a38000 thermal_sys 14790 3 fan,processor,thermal, Live 0xf7a26000 ata_generic 3015 0 - Live 0xf7a17000
opensuse:~ # cat /proc/diskstats 8 0 sda 14117 2556 764125 207273 1523 2002 28034 19186 0 26442 226384 8 1 sda1 274 8 2208 486 2 0 10 0 0 485 485 8 2 sda2 11210 1268 747068 200596 1467 2002 28024 19157 0 26155 219700 8 3 sda3 1075 1280 2397 920 0 0 0 0 0 882 900 8 4 sda4 2 0 4 52 0 0 0 0 0 52 52 8 5 sda5 163 0 1304 860 0 0 0 0 0 860 860 8 6 sda6 163 0 1304 726 0 0 0 0 0 606 725 8 7 sda7 163 0 1304 422 0 0 0 0 0 422 422 8 8 sda8 163 0 1304 516 0 0 0 0 0 516 516 8 9 sda9 163 0 1304 441 0 0 0 0 0 441 441 8 10 sda10 163 0 1304 765 0 0 0 0 0 765 765 8 11 sda11 163 0 1304 802 0 0 0 0 0 802 802 8 12 sda12 160 0 1280 645 0 0 0 0 0 645 645 11 0 sr0 0 0 0 0 0 0 0 0 0 0 0
opensuse:~ # cat /proc/partitions major minor #blocks name 8 0 16777216 sda 8 1 111616 sda1 8 2 8674915 sda2 8 3 2048287 sda3 8 4 1 sda4 8 5 512000 sda5 8 6 204800 sda6 8 7 307200 sda7 8 8 512000 sda8 8 9 409600 sda9 8 10 512000 sda10 8 11 512000 sda11 8 12 204800 sda12
opensuse:~ # cat /proc/swaps Filename Type Size Used Priority /dev/sda3 partition 2048280 0 -1
opensuse:~ # cat /proc/loadavg 0.02 0.13 0.16 2/288 6970
opensuse:~ # cat /proc/meminfo MemTotal: 1012320 kB MemFree: 202552 kB Buffers: 85776 kB Cached: 478128 kB SwapCached: 0 kB Active: 332040 kB Inactive: 420828 kB Active(anon): 189136 kB Inactive(anon): 7996 kB Active(file): 142904 kB Inactive(file): 412832 kB Unevictable: 0 kB Mlocked: 0 kB HighTotal: 135112 kB HighFree: 292 kB LowTotal: 877208 kB LowFree: 202260 kB SwapTotal: 2048280 kB SwapFree: 2048280 kB Dirty: 76 kB Writeback: 0 kB AnonPages: 188964 kB Mapped: 97288 kB Shmem: 8168 kB Slab: 40532 kB SReclaimable: 30248 kB SUnreclaim: 10284 kB KernelStack: 2280 kB PageTables: 5176 kB NFS_Unstable: 0 kB Bounce: 0 kB WritebackTmp: 0 kB CommitLimit: 2554440 kB Committed_AS: 1317152 kB VmallocTotal: 122880 kB VmallocUsed: 28468 kB VmallocChunk: 86004 kB HardwareCorrupted: 0 kB HugePages_Total: 0 HugePages_Free: 0 HugePages_Rsvd: 0 HugePages_Surp: 0 Hugepagesize: 2048 kB DirectMap4k: 12280 kB DirectMap2M: 890880 kB
opensuse:~ # cat /proc/version Linux version 2.6.37.6-0.5-desktop (geeko@buildhost) (gcc version 4.5.1 20101208 [gcc-4_5-branch revision 167585] (SUSE Linux) ) #1 SMP PREEMPT 2011-04-25 21:48:33 +0200
Les informations brutes stockées dans /proc peuvent être interprétées grâce à l'utilisation des commandes dites de gestion des performances :
Par défaut les exécutables iostat, vmstat, mpstat et sar ne sont pas installés sous openSUSE. Il convient donc de les installer à l'aide de la commande zypper :
opensuse:~ # zypper install sysstat Loading repository data... Reading installed packages... Resolving package dependencies... The following NEW package is going to be installed: sysstat 1 new package to install. Overall download size: 194.0 KiB. After the operation, additional 755.0 KiB will be used. Continue? [y/n/?] (y): y Retrieving package sysstat-9.0.6.1-14.15.1.i586 (1/1), 194.0 KiB (755.0 KiB unpacked) Retrieving: sysstat-9.0.6.1-14.15.1.i586.rpm [done] Installing: sysstat-9.0.6.1-14.15.1 [done]
La commande free permet de donner l’état de la mémoire totale, libre, partagée, swap et bufferisée. Saisissez donc la commande suivante :
opensuse:~ # free -m total used free shared buffers cached Mem: 988 603 384 0 14 377 -/+ buffers/cache: 211 776 Swap: 2000 0 2000
Dans le cas de cet exemple, nous pouvons constater que l’affichage montre :
La ligne -/+ buffers/cache: indique que les applications utilisent 211 Mo et qu’elles disposent de 775 Mo de mémoire libre (14+377+384).
Les options de cette commande sont :
opensuse:~ # free -h free: invalid option -- 'h' usage: free [-b|-k|-m|-g] [-l] [-o] [-t] [-s delay] [-c count] [-V] -b,-k,-m,-g show output in bytes, KB, MB, or GB -l show detailed low and high memory statistics -o use old format (no -/+buffers/cache line) -t display total for RAM + swap -s update every [delay] seconds -c update [count] times -V display version information and exit
Chacune des ces commandes indique la charge moyenne du ou des processeurs depuis 1 minute, 5 minutes et 15 minutes :
opensuse:~ # uptime 15:51pm up 0:13, 3 users, load average: 0.15, 0.26, 0.16 opensuse:~ # w 15:51:13 up 13 min, 3 users, load average: 0.15, 0.26, 0.16 USER TTY LOGIN@ IDLE JCPU PCPU WHAT trainee :0 15:46 ?xdm? 52.33s 0.03s /usr/lib/gdm/gdm-simple-slave - trainee console 15:46 12:59 0.00s 0.03s /usr/lib/gdm/gdm-simple-slave - trainee pts/0 15:47 0.00s 0.09s 1.45s gnome-terminal
Les valeurs load average ou charge moyenne indiquent le nombre moyen de processus en cours de traitement ou en attente pour la période concernée.
Par exemple si les valeurs sur un système muni d'un seul processeur étaient 3,48 4,00 3,85 ceci indiquerait que le processeur a du mal à traiter les processus mettant en moyenne :
Les options de ces commandes sont :
opensuse:~ # uptime --help Usage: uptime [OPTION]... [FILE] Print the current time, the length of time the system has been up, the number of users on the system, and the average number of jobs in the run queue over the last 1, 5 and 15 minutes. Processes in an uninterruptible sleep state also contribute to the load average. If FILE is not specified, use /var/run/utmp. /var/log/wtmp as FILE is common. --help display this help and exit --version output version information and exit Report uptime bugs to bug-coreutils@gnu.org GNU coreutils home page: <http://www.gnu.org/software/coreutils/> General help using GNU software: <http://www.gnu.org/gethelp/> Report uptime translation bugs to <http://translationproject.org/team/> For complete documentation, run: info coreutils 'uptime invocation' opensuse:~ # w --help w: invalid option -- '-' usage: w -hlsufV [user] -h skip header -l long listing (default) -s short listing -n non truncated listing (large) -u ignore uid of processes -f toggle FROM field (default off) -V display version
La commande iostat affiche des statistiques sur l'utilisation des disques, des terminaux et des lecteurs de cartouche :
opensuse:~ # iostat Linux 2.6.37.6-0.5-desktop (opensuse) 04/09/12 _i686_ (1 CPU) avg-cpu: %user %nice %system %iowait %steal %idle 6.71 0.60 4.21 1.56 0.00 86.92 Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn sda 16.03 686.86 71.50 806597 83962
Au-dessous de la première ligne indiquant la version du noyau du système et son nom d'hôte ainsi que la date actuelle, iostat affiche une vue d'ensemble de l'utilisation CPU moyenne du système depuis le dernier démarrage. Le rapport d'utilisation du CPU inclut les pourcentages suivants :
Notez la valeur de %iowait. Dans le cas où ce pourcentage est trop élévé, ceci indique que le processeur passe son temps à attendre les entrées et les sorties de disque.
Pour surveiller la vitesse des entrées et des sorties du disque, vous pouvez utiliser la commande hdparm :
opensuse:~ # hdparm -t /dev/sda /dev/sda: Timing buffered disk reads: 246 MB in 3.03 seconds = 81.14 MB/sec
Au-dessous du rapport d'utilisation du CPU figure le rapport d'utilisation des périphériques. Ce dernier contient une ligne pour chaque périphérique disque du système et inclut les informations suivantes :
Les options de cette commande sont :
opensuse:~ # iostat --help Usage: iostat [ options ] [ <interval> [ <count> ] ] Options are: [ -c ] [ -d ] [ -N ] [ -n ] [ -h ] [ -k | -m ] [ -t ] [ -V ] [ -x ] [ -z ] [ <device> [...] | ALL ] [ -p [ <device> [,...] | ALL ] ]
La commande vmstat affiche des statistiques sur la mémoire, la pagination et la charge ponctuelle du processeur :
opensuse:~ # vmstat 1 10 procs -----------memory---------- ---swap-- -----io---- -system-- -----cpu------ r b swpd free buff cache si so bi bo in cs us sy id wa st 0 0 0 350536 16092 405408 0 0 518 35 279 789 8 4 86 2 0 0 0 0 350412 16092 405396 0 0 0 0 341 781 3 2 95 0 0 0 0 0 348552 16092 407788 0 0 0 0 632 2508 14 10 76 0 0 1 0 0 347932 16092 407780 0 0 0 0 339 856 9 2 89 0 0 0 0 0 347956 16092 407784 0 0 0 0 344 856 9 3 88 0 0 0 0 0 347956 16092 407784 0 0 0 0 354 842 9 2 89 0 0 0 0 0 347956 16100 407784 0 0 0 48 478 1104 11 4 85 0 0 0 0 0 347956 16100 407784 0 0 0 8 380 923 11 3 86 0 0 0 0 0 347980 16100 407784 0 0 0 0 403 868 6 3 91 0 0 1 0 0 347980 16108 407828 0 0 0 56 390 927 12 2 86 0 0
La première ligne subdivise le champ en six catégories à savoir : processus, mémoire, swap, E/S, système et CPU sur lesquelles elle donne des statistiques. La seconde ligne identifie de manière encore plus détaillée chacun des champs, permettant ainsi de parcourir simplement et rapidement l'ensemble des données lors de la recherche de statistiques spécifiques.
Les champs relatifs aux processus sont les suivants :
Les champs relatifs à la mémoire sont les suivants :
Les champs relatifs au swap sont les suivants :
Les champs relatifs aux Entrées/Sorties (E/S) sont les suivants :
Les champs relatifs au système sont les suivants :
Les champs relatifs au CPU sont les suivants :
Les options de cette commande sont :
opensuse:~ # vmstat --help usage: vmstat [-V] [-n] [delay [count]] -V prints version. -n causes the headers not to be reprinted regularly. -a print inactive/active page stats. -d prints disk statistics -D prints disk table -p prints disk partition statistics -s prints vm table -m prints slabinfo -S unit size delay is the delay between updates in seconds. unit size k:1000 K:1024 m:1000000 M:1048576 (default is K) count is the number of updates.
Par défaut la commande vmstat affiche des informations depuis le démarrage du système.
La commande mpstat affiche des statistiques détaillées sur le CPU :
opensuse:~ # mpstat Linux 2.6.37.6-0.5-desktop (opensuse) 04/09/12 _i686_ (1 CPU) 16:00:27 CPU %usr %nice %sys %iowait %irq %soft %steal %guest %idle 16:00:27 all 7.27 0.53 4.36 1.56 0.00 0.11 0.00 0.00 86.17
Dans le cas où vous avez plusieurs processeurs ou coeurs, vous pouvez visualiser ces mêmes informations par unité de traitement :
opensuse:~ # mpstat -P ALL Linux 2.6.37.6-0.5-desktop (opensuse) 04/09/12 _i686_ (1 CPU) 16:00:35 CPU %usr %nice %sys %iowait %irq %soft %steal %guest %idle 16:00:35 all 7.25 0.53 4.34 1.55 0.00 0.11 0.00 0.00 86.22 16:00:35 0 7.25 0.53 4.34 1.55 0.00 0.11 0.00 0.00 86.22
Pour afficher 5 jeux de statistiques à des intervales de 2 secondes pour tous les unités de traitement, il convient d'utiliser la commande suivante :
opensuse:~ # mpstat -P ALL 2 5 Linux 2.6.37.6-0.5-desktop (opensuse) 04/09/12 _i686_ (1 CPU) 16:00:45 CPU %usr %nice %sys %iowait %irq %soft %steal %guest %idle 16:00:47 all 2.99 0.00 1.00 0.00 0.00 0.00 0.00 0.00 96.02 16:00:47 0 2.99 0.00 1.00 0.00 0.00 0.00 0.00 0.00 96.02 16:00:47 CPU %usr %nice %sys %iowait %irq %soft %steal %guest %idle 16:00:49 all 2.00 0.00 1.50 0.00 0.00 0.00 0.00 0.00 96.50 16:00:49 0 2.00 0.00 1.50 0.00 0.00 0.00 0.00 0.00 96.50 16:00:49 CPU %usr %nice %sys %iowait %irq %soft %steal %guest %idle 16:00:51 all 13.50 0.00 8.00 0.00 0.00 0.00 0.00 0.00 78.50 16:00:51 0 13.50 0.00 8.00 0.00 0.00 0.00 0.00 0.00 78.50 16:00:51 CPU %usr %nice %sys %iowait %irq %soft %steal %guest %idle 16:00:53 all 25.13 0.00 10.55 0.00 0.00 0.50 0.00 0.00 63.82 16:00:53 0 25.13 0.00 10.55 0.00 0.00 0.50 0.00 0.00 63.82 16:00:53 CPU %usr %nice %sys %iowait %irq %soft %steal %guest %idle 16:00:55 all 38.38 0.00 21.72 0.00 0.00 0.00 0.00 0.00 39.90 16:00:55 0 38.38 0.00 21.72 0.00 0.00 0.00 0.00 0.00 39.90 Average: CPU %usr %nice %sys %iowait %irq %soft %steal %guest %idle Average: all 16.33 0.00 8.52 0.00 0.00 0.10 0.00 0.00 75.05 Average: 0 16.33 0.00 8.52 0.00 0.00 0.10 0.00 0.00 75.05
Les options de cette commande sont :
opensuse:~ # mpstat --help Usage: mpstat [ options ] [ <interval> [ <count> ] ] Options are: [ -A ] [ -I { SUM | CPU | ALL } ] [ -u ] [ -P { <cpu> [,...] | ALL } ] [ -V ]
La commande sar permet de surveiller toutes les ressources du système selon l'option qui est passée en argument à la commande. Quelques options importantes sont :
Option | Description |
---|---|
-u | Pourcentage d'utilisation du CPU |
-q | Nombre de processus en attente |
-r | Utilisation de la mémoire centrale |
-w | Surveillance du swapping |
-p | Surveillance de la pagination |
-b | Utilisation des tampons |
-d | Utilisation des disques |
La commande /usr/lib/sa/sadc permet de collecter les informations.
opensuse:~ # ls /usr/lib/sa sa1 sa2 sadc
Le script /usr/lib/sa/sa1 exécute la commande /usr/lib/sa/sadc. Ce script prend deux options :
Option | Description |
---|---|
-t | L'interval entre les collectes |
-n | Nombre de collectes |
Le script /usr/lib/sa/sa2 exécute la commande sar et consigne les informations dans un fichier au format /var/log/sa/sar<jj>.
Pour pouvoir fonctionner correctement, ces scripts doivent être appelés par cron.
Pour constater ce fonctionnement manuellement saisissez la commande suivante :
opensuse:~ # /usr/lib/sa/sa1 5 5
Saisissez ensuite les commandes suivantes :
opensuse:~ # sar Linux 2.6.37.6-0.5-desktop (opensuse) 04/09/12 _i686_ (1 CPU) 16:03:19 CPU %user %nice %system %iowait %steal %idle 16:03:24 all 7.21 0.00 5.61 0.20 0.00 86.97 16:03:29 all 10.04 0.00 4.02 0.00 0.00 85.94 16:03:34 all 2.99 0.00 3.59 0.00 0.00 93.41 16:03:39 all 0.60 0.00 0.60 0.00 0.00 98.80 Average: all 5.21 0.00 3.46 0.05 0.00 91.28 opensuse:~ # sar -u 5 3 Linux 2.6.37.6-0.5-desktop (opensuse) 04/09/12 _i686_ (1 CPU) 16:03:53 CPU %user %nice %system %iowait %steal %idle 16:03:58 all 1.60 0.00 1.60 0.00 0.00 96.80 16:04:03 all 0.20 0.20 0.40 0.00 0.00 99.20 16:04:08 all 0.60 0.40 1.00 0.00 0.00 98.00 Average: all 0.80 0.20 1.00 0.00 0.00 98.00 opensuse:~ # sar -r 5 3 Linux 2.6.37.6-0.5-desktop (opensuse) 04/09/12 _i686_ (1 CPU) 16:04:13 kbmemfree kbmemused %memused kbbuffers kbcached kbcommit %commit 16:04:18 348360 663960 65.59 16444 391192 1474840 48.19 16:04:23 348616 663704 65.56 16444 390408 1474056 48.16 16:04:28 348616 663704 65.56 16452 390408 1474056 48.16 Average: 348531 663789 65.57 16447 390669 1474317 48.17 opensuse:~ # sar -w 5 3 Linux 2.6.37.6-0.5-desktop (opensuse) 04/09/12 _i686_ (1 CPU) 16:04:32 proc/s cswch/s 16:04:37 0.00 125.25 16:04:42 0.00 59.60 16:04:47 0.00 52.30 Average: 0.00 79.04 opensuse:~ # sar -b 5 3 Linux 2.6.37.6-0.5-desktop (opensuse) 04/09/12 _i686_ (1 CPU) 16:04:53 tps rtps wtps bread/s bwrtn/s 16:04:58 0.00 0.00 0.00 0.00 0.00 16:05:03 2.21 0.00 2.21 0.00 25.70 16:05:08 0.00 0.00 0.00 0.00 0.00 Average: 0.74 0.00 0.74 0.00 8.56 opensuse:~ # sar -d 5 3 Linux 2.6.37.6-0.5-desktop (opensuse) 04/09/12 _i686_ (1 CPU) 16:05:18 DEV tps rd_sec/s wr_sec/s avgrq-sz avgqu-sz await svctm %util 16:05:23 dev8-0 2.40 0.00 41.52 17.33 0.00 1.00 0.42 0.10 16:05:23 DEV tps rd_sec/s wr_sec/s avgrq-sz avgqu-sz await svctm %util 16:05:28 dev8-0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 16:05:28 DEV tps rd_sec/s wr_sec/s avgrq-sz avgqu-sz await svctm %util 16:05:33 dev8-0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 Average: DEV tps rd_sec/s wr_sec/s avgrq-sz avgqu-sz await svctm %util Average: dev8-0 0.80 0.00 13.87 17.33 0.00 1.00 0.42 0.03 opensuse:~ # sar -p 5 3 Linux 2.6.37.6-0.5-desktop (opensuse) 04/09/12 _i686_ (1 CPU) 16:05:37 CPU %user %nice %system %iowait %steal %idle 16:05:42 all 0.40 0.00 0.60 0.20 0.00 98.80 16:05:47 all 0.20 0.00 0.20 0.00 0.00 99.60 16:05:52 all 0.00 0.00 0.40 0.00 0.00 99.60 Average: all 0.20 0.00 0.40 0.07 0.00 99.33 opensuse:~ # sar -v 5 3 Linux 2.6.37.6-0.5-desktop (opensuse) 04/09/12 _i686_ (1 CPU) 16:05:58 dentunusd file-nr inode-nr pty-nr 16:06:03 31766 5184 20159 47 16:06:08 31767 5280 20169 47 16:06:13 31767 5280 20169 47 Average: 31767 5248 20166 47
Les options de cette commande sont :
opensuse:~ # sar --help Usage: sar [ options ] [ <interval> [ <count> ] ] Options are: [ -A ] [ -b ] [ -B ] [ -C ] [ -d ] [ -h ] [ -m ] [ -p ] [ -q ] [ -r ] [ -R ] [ -S ] [ -t ] [ -u [ ALL ] ] [ -v ] [ -V ] [ -w ] [ -W ] [ -y ] [ -I { <int> [,...] | SUM | ALL | XALL } ] [ -P { <cpu> [,...] | ALL } ] [ -n { <keyword> [,...] | ALL } ] [ -o [ <filename> ] | -f [ <filename> ] ] [ -i <interval> ] [ -s [ <hh:mm:ss> ] ] [ -e [ <hh:mm:ss> ] ]
Dans ce cas utilisez les commandes suivantes :
Dans ce cas utilisez les commandes suivantes :
Utilisez la commande :
L'USB (Universal Serial Bus) est un bus de données qui peut offrir des taux de transfert jusqu'à 480Mb/s sous la version 2.0 et jusqu'à 4.8 Gb/s sous la version 3.0. Les modules nécessaires pour les contrôleurs USB sont :
Version USB | Module | Nom Complet |
---|---|---|
1.0\1.1 | UHCI | Universal Controller Host Interface |
OHCI | Open Controller Host Interface | |
2.0 | EHCI | Enhanced Host Controller Interface |
3.0 | XHCI | Extensible Host Controller Interface |
Le tableau suivant liste les modules courrament chargés en fonction du périphérique utilisé :
Module | Type de Périphérique |
---|---|
usb_storage | Supports de masse |
usbhid | Periphériques HID (Human Interface Device) |
snd-usb-audio | Cartes son usb |
usbvidéo | Cartes vidéo et d'acquisition |
irda-usb | Périphériques infrarouges |
usbnet | Cartes réseaux usb |
Les modules peuvent être chargés par un des moyens suivants :
<note> Branchez une clef USB avant de continuer. Si vous utilisez VirtualBox, activez la clef dans votre machine virtuelle grâce aux menus Périphériques > Périphériques USB > le_nom_de_votre_clef. </note>
Le noyau Linux 2.6 est capable de détecter des périphériques branchés à chaud. Cette technologie s'appelle le hotplugging. Le hotplugging est obtenu grâce à l'utilisation de trois composants :
Les rôles de chaque composant sont les suivants :
Lors de démarrage de Linux, Udev joue un rôle important :
Udev repose sur le filesystem sysfs monté sur /sys qui permet de rendre les périphériques visibles à Udev dans l'User Space. Par exemple, lors du branchement d'une clé USB, Udev crée /dev/sdb1 automatiquement :
opensuse:~ # ls /dev | grep sdb sdb sdb1 opensuse:~ # ls -l /dev/.udev/db | grep 08:31 -rw-r--r-- 1 root root 741 Apr 10 08:31 b8:16 -rw-r--r-- 1 root root 1204 Apr 10 08:31 b8:17 -rw-r--r-- 1 root root 342 Apr 10 08:31 c189:1 -rw-r--r-- 1 root root 0 Apr 10 08:31 c21:2 -rw-r--r-- 1 root root 0 Apr 10 08:31 c253:2 opensuse:~ # ls /sys/block/sdb alignment_offset device inflight removable slaves uevent bdi discard_alignment power ro stat capability ext_range queue sdb1 subsystem dev holders range size trace
et utilise les informations contenues dans le fichier /lib/modules/`uname -r`/modules.alias pour trouver le pilote nécessaire :
Le contenu des fichiers non-vides créés dans le répertoire /dev/.udev/db/ est :
opensuse:~ # cat /dev/.udev/db/b8:16 N:sdb S:disk/by-id/usb-JetFlash_Transcend_8GB_48MSBMWJ2851SPKF-0:0 S:disk/by-path/pci-0000:00:0b.0-usb-0:1:1.0-scsi-0:0:0:0 W:28 I:3054855415 E:ID_VENDOR=JetFlash E:ID_VENDOR_ENC=JetFlash E:ID_VENDOR_ID=8564 E:ID_MODEL=Transcend_8GB E:ID_MODEL_ENC=Transcend\x208GB\x20\x20\x20 E:ID_MODEL_ID=1000 E:ID_REVISION=1100 E:ID_SERIAL=JetFlash_Transcend_8GB_48MSBMWJ2851SPKF-0:0 E:ID_SERIAL_SHORT=48MSBMWJ2851SPKF E:ID_TYPE=disk E:ID_INSTANCE=0:0 E:ID_BUS=usb E:ID_USB_INTERFACES=:080650: E:ID_USB_INTERFACE_NUM=00 E:ID_USB_DRIVER=usb-storage E:ID_PATH=pci-0000:00:0b.0-usb-0:1:1.0-scsi-0:0:0:0 E:ID_PART_TABLE_TYPE=dos E:UDISKS_PRESENTATION_NOPOLICY=0 E:UDISKS_PARTITION_TABLE=1 E:UDISKS_PARTITION_TABLE_SCHEME=mbr E:UDISKS_PARTITION_TABLE_COUNT=1 opensuse:~ # cat /dev/.udev/db/b8:17 N:sdb1 S:disk/by-id/usb-JetFlash_Transcend_8GB_48MSBMWJ2851SPKF-0:0-part1 S:disk/by-path/pci-0000:00:0b.0-usb-0:1:1.0-scsi-0:0:0:0-part1 S:disk/by-uuid/2D9370690D5D6E39 W:29 I:3055647514 E:ID_VENDOR=JetFlash E:ID_VENDOR_ENC=JetFlash E:ID_VENDOR_ID=8564 E:ID_MODEL=Transcend_8GB E:ID_MODEL_ENC=Transcend\x208GB\x20\x20\x20 E:ID_MODEL_ID=1000 E:ID_REVISION=1100 E:ID_SERIAL=JetFlash_Transcend_8GB_48MSBMWJ2851SPKF-0:0 E:ID_SERIAL_SHORT=48MSBMWJ2851SPKF E:ID_TYPE=disk E:ID_INSTANCE=0:0 E:ID_BUS=usb E:ID_USB_INTERFACES=:080650: E:ID_USB_INTERFACE_NUM=00 E:ID_USB_DRIVER=usb-storage E:ID_PATH=pci-0000:00:0b.0-usb-0:1:1.0-scsi-0:0:0:0 E:ID_PART_TABLE_TYPE=dos E:ID_FS_UUID=2D9370690D5D6E39 E:ID_FS_UUID_ENC=2D9370690D5D6E39 E:ID_FS_TYPE=ntfs E:ID_FS_USAGE=filesystem E:ID_PART_ENTRY_SCHEME=dos E:ID_PART_ENTRY_TYPE=0x7 E:ID_PART_ENTRY_NUMBER=1 E:UDISKS_PRESENTATION_NOPOLICY=0 E:UDISKS_PARTITION=1 E:UDISKS_PARTITION_SCHEME=mbr E:UDISKS_PARTITION_NUMBER=1 E:UDISKS_PARTITION_TYPE=0x07 E:UDISKS_PARTITION_SIZE=8098152448 E:UDISKS_PARTITION_SLAVE=/sys/devices/pci0000:00/0000:00:0b.0/usb1/1-1/1-1:1.0/host3/target3:0:0/3:0:0:0/block/sdb E:UDISKS_PARTITION_OFFSET=1048576 E:UDISKS_PARTITION_ALIGNMENT_OFFSET=0 opensuse:~ # cat /dev/.udev/db/c189:1 N:bus/usb/001/002 I:3052871140 E:ID_VENDOR=JetFlash E:ID_VENDOR_ENC=JetFlash E:ID_VENDOR_ID=8564 E:ID_MODEL=Mass_Storage_Device E:ID_MODEL_ENC=Mass\x20Storage\x20Device E:ID_MODEL_ID=1000 E:ID_REVISION=1100 E:ID_SERIAL=JetFlash_Mass_Storage_Device_48MSBMWJ2851SPKF E:ID_SERIAL_SHORT=48MSBMWJ2851SPKF E:ID_BUS=usb E:ID_USB_INTERFACES=:080650:
Voici le contenu de /dev :
opensuse:~ # ls -lR /dev/disk /dev/disk: total 0 drwxr-xr-x 2 root root 620 Apr 10 08:31 by-id drwxr-xr-x 2 root root 360 Apr 10 08:31 by-path drwxr-xr-x 2 root root 120 Apr 10 08:31 by-uuid /dev/disk/by-id: total 0 lrwxrwxrwx 1 root root 9 Apr 9 15:38 ata-VBOX_CD-ROM_VB2-01700376 -> ../../sr0 lrwxrwxrwx 1 root root 9 Apr 9 15:38 ata-VBOX_HARDDISK_VB50f75dcc-537a53dd -> ../../sda lrwxrwxrwx 1 root root 10 Apr 9 15:38 ata-VBOX_HARDDISK_VB50f75dcc-537a53dd-part1 -> ../../sda1 lrwxrwxrwx 1 root root 11 Apr 9 15:38 ata-VBOX_HARDDISK_VB50f75dcc-537a53dd-part10 -> ../../sda10 lrwxrwxrwx 1 root root 11 Apr 9 15:38 ata-VBOX_HARDDISK_VB50f75dcc-537a53dd-part11 -> ../../sda11 lrwxrwxrwx 1 root root 11 Apr 9 15:38 ata-VBOX_HARDDISK_VB50f75dcc-537a53dd-part12 -> ../../sda12 lrwxrwxrwx 1 root root 10 Apr 9 15:38 ata-VBOX_HARDDISK_VB50f75dcc-537a53dd-part2 -> ../../sda2 lrwxrwxrwx 1 root root 10 Apr 9 15:38 ata-VBOX_HARDDISK_VB50f75dcc-537a53dd-part3 -> ../../sda3 lrwxrwxrwx 1 root root 10 Apr 9 15:38 ata-VBOX_HARDDISK_VB50f75dcc-537a53dd-part4 -> ../../sda4 lrwxrwxrwx 1 root root 10 Apr 9 15:38 ata-VBOX_HARDDISK_VB50f75dcc-537a53dd-part5 -> ../../sda5 lrwxrwxrwx 1 root root 10 Apr 9 15:38 ata-VBOX_HARDDISK_VB50f75dcc-537a53dd-part6 -> ../../sda6 lrwxrwxrwx 1 root root 10 Apr 9 15:38 ata-VBOX_HARDDISK_VB50f75dcc-537a53dd-part7 -> ../../sda7 lrwxrwxrwx 1 root root 10 Apr 9 15:38 ata-VBOX_HARDDISK_VB50f75dcc-537a53dd-part8 -> ../../sda8 lrwxrwxrwx 1 root root 10 Apr 9 15:38 ata-VBOX_HARDDISK_VB50f75dcc-537a53dd-part9 -> ../../sda9 lrwxrwxrwx 1 root root 9 Apr 9 15:38 scsi-SATA_VBOX_HARDDISK_VB50f75dcc-537a53dd -> ../../sda lrwxrwxrwx 1 root root 10 Apr 9 15:38 scsi-SATA_VBOX_HARDDISK_VB50f75dcc-537a53dd-part1 -> ../../sda1 lrwxrwxrwx 1 root root 11 Apr 9 15:38 scsi-SATA_VBOX_HARDDISK_VB50f75dcc-537a53dd-part10 -> ../../sda10 lrwxrwxrwx 1 root root 11 Apr 9 15:38 scsi-SATA_VBOX_HARDDISK_VB50f75dcc-537a53dd-part11 -> ../../sda11 lrwxrwxrwx 1 root root 11 Apr 9 15:38 scsi-SATA_VBOX_HARDDISK_VB50f75dcc-537a53dd-part12 -> ../../sda12 lrwxrwxrwx 1 root root 10 Apr 9 15:38 scsi-SATA_VBOX_HARDDISK_VB50f75dcc-537a53dd-part2 -> ../../sda2 lrwxrwxrwx 1 root root 10 Apr 9 15:38 scsi-SATA_VBOX_HARDDISK_VB50f75dcc-537a53dd-part3 -> ../../sda3 lrwxrwxrwx 1 root root 10 Apr 9 15:38 scsi-SATA_VBOX_HARDDISK_VB50f75dcc-537a53dd-part4 -> ../../sda4 lrwxrwxrwx 1 root root 10 Apr 9 15:38 scsi-SATA_VBOX_HARDDISK_VB50f75dcc-537a53dd-part5 -> ../../sda5 lrwxrwxrwx 1 root root 10 Apr 9 15:38 scsi-SATA_VBOX_HARDDISK_VB50f75dcc-537a53dd-part6 -> ../../sda6 lrwxrwxrwx 1 root root 10 Apr 9 15:38 scsi-SATA_VBOX_HARDDISK_VB50f75dcc-537a53dd-part7 -> ../../sda7 lrwxrwxrwx 1 root root 10 Apr 9 15:38 scsi-SATA_VBOX_HARDDISK_VB50f75dcc-537a53dd-part8 -> ../../sda8 lrwxrwxrwx 1 root root 10 Apr 9 15:38 scsi-SATA_VBOX_HARDDISK_VB50f75dcc-537a53dd-part9 -> ../../sda9 lrwxrwxrwx 1 root root 9 Apr 10 08:31 usb-JetFlash_Transcend_8GB_48MSBMWJ2851SPKF-0:0 -> ../../sdb lrwxrwxrwx 1 root root 10 Apr 10 08:31 usb-JetFlash_Transcend_8GB_48MSBMWJ2851SPKF-0:0-part1 -> ../../sdb1 /dev/disk/by-path: total 0 lrwxrwxrwx 1 root root 9 Apr 9 15:38 pci-0000:00:01.1-scsi-0:0:0:0 -> ../../sda lrwxrwxrwx 1 root root 10 Apr 9 15:38 pci-0000:00:01.1-scsi-0:0:0:0-part1 -> ../../sda1 lrwxrwxrwx 1 root root 11 Apr 9 15:38 pci-0000:00:01.1-scsi-0:0:0:0-part10 -> ../../sda10 lrwxrwxrwx 1 root root 11 Apr 9 15:38 pci-0000:00:01.1-scsi-0:0:0:0-part11 -> ../../sda11 lrwxrwxrwx 1 root root 11 Apr 9 15:38 pci-0000:00:01.1-scsi-0:0:0:0-part12 -> ../../sda12 lrwxrwxrwx 1 root root 10 Apr 9 15:38 pci-0000:00:01.1-scsi-0:0:0:0-part2 -> ../../sda2 lrwxrwxrwx 1 root root 10 Apr 9 15:38 pci-0000:00:01.1-scsi-0:0:0:0-part3 -> ../../sda3 lrwxrwxrwx 1 root root 10 Apr 9 15:38 pci-0000:00:01.1-scsi-0:0:0:0-part4 -> ../../sda4 lrwxrwxrwx 1 root root 10 Apr 9 15:38 pci-0000:00:01.1-scsi-0:0:0:0-part5 -> ../../sda5 lrwxrwxrwx 1 root root 10 Apr 9 15:38 pci-0000:00:01.1-scsi-0:0:0:0-part6 -> ../../sda6 lrwxrwxrwx 1 root root 10 Apr 9 15:38 pci-0000:00:01.1-scsi-0:0:0:0-part7 -> ../../sda7 lrwxrwxrwx 1 root root 10 Apr 9 15:38 pci-0000:00:01.1-scsi-0:0:0:0-part8 -> ../../sda8 lrwxrwxrwx 1 root root 10 Apr 9 15:38 pci-0000:00:01.1-scsi-0:0:0:0-part9 -> ../../sda9 lrwxrwxrwx 1 root root 9 Apr 9 15:38 pci-0000:00:01.1-scsi-1:0:0:0 -> ../../sr0 lrwxrwxrwx 1 root root 9 Apr 10 08:31 pci-0000:00:0b.0-usb-0:1:1.0-scsi-0:0:0:0 -> ../../sdb lrwxrwxrwx 1 root root 10 Apr 10 08:31 pci-0000:00:0b.0-usb-0:1:1.0-scsi-0:0:0:0-part1 -> ../../sdb1 /dev/disk/by-uuid: total 0 lrwxrwxrwx 1 root root 10 Apr 10 08:31 2D9370690D5D6E39 -> ../../sdb1 lrwxrwxrwx 1 root root 10 Apr 9 15:38 813e9bdb-617e-418a-886f-d7d5e7ba9641 -> ../../sda1 lrwxrwxrwx 1 root root 10 Apr 9 15:38 99168f5b-9860-4701-b8b7-d938d4a536ca -> ../../sda2 lrwxrwxrwx 1 root root 10 Apr 9 15:38 a4e52ae0-19fa-427c-bd30-e1d4193f8d3d -> ../../sda3
Le fichier de configuration principal d'Udev est /etc/udev/udev.conf :
opensuse:~ # cat /etc/udev/udev.conf # The initial syslog(3) priority: "err", "info", "debug" or its # numerical equivalent. For runtime debugging, the daemons internal # state can be changed with: "udevadm control --log-priority=<value>". udev_log="err"
Les fichiers de règles se trouvent dans /lib/udev/rules.d/ :
opensuse:~ # ls /lib/udev/rules.d/ 10-dm.rules 60-persistent-storage.rules 77-mm-pcmcia-device-blacklist.rules 95-keymap.rules 11-dm-lvm.rules 60-persistent-v4l.rules 77-mm-platform-serial-whitelist.rules 95-udev-late.rules 13-dm-disk.rules 61-mobile-action.rules 77-mm-simtech-port-types.rules 95-upower-battery-recall-dell.rules 39-libmtp.rules 61-persistent-storage-edd.rules 77-mm-usb-device-blacklist.rules 95-upower-battery-recall-fujitsu.rules 40-libgphoto2.rules 64-md-raid.rules 77-mm-zte-port-types.rules 95-upower-battery-recall-gateway.rules 40-usb-media-players.rules 65-xorg-wacom.rules 77-nm-olpc-mesh.rules 95-upower-battery-recall-ibm.rules 40-usb_modeswitch.rules 69-xorg-vmmouse.rules 78-sound-card.rules 95-upower-battery-recall-lenovo.rules 42-qemu-usb.rules 70-acl.rules 79-fstab_import.rules 95-upower-battery-recall-toshiba.rules 50-firmware.rules 70-hid2hci.rules 80-drivers.rules 95-upower-csr.rules 50-udev-default.rules 70-printers.rules 80-udisks.rules 95-upower-hid.rules 56-idedma.rules 75-cd-aliases-generator.rules 85-regulatory.rules 95-upower-wup.rules 60-cdrom_id.rules 75-net-description.rules 85-usbmuxd.rules 97-bluetooth-hid2hci.rules 60-floppy.rules 75-persistent-net-generator.rules 90-alsa-restore.rules 97-bluetooth-serial.rules 60-persistent-alsa.rules 75-probe_mtd.rules 90-libgpod.rules 97-bluetooth.rules 60-persistent-input.rules 75-tty-description.rules 90-pulseaudio.rules 60-persistent-serial.rules 77-mm-ericsson-mbm.rules 95-dm-notify.rules 60-persistent-storage-tape.rules 77-mm-longcheer-port-types.rules 95-keyboard-force-release.rules
<note important> Il vous est possible d'ajouter des règles si besoin est. Dans ce cas, créez un fichier 99-local.rules est éditez-le au lieu d'éditer les fichiers existants. </note>
Comme indique le nom de chaque fichier, le contenu est composé de règles à l'attention d'udev. Le fichier des règles par défaut est le 50-udev-default.rules :
opensuse:~ # cat /lib/udev/rules.d/50-udev-default.rules # do not edit this file, it will be overwritten on update KERNEL=="pty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="tty", MODE="0660" KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="tty", MODE="0660" KERNEL=="ptmx", GROUP="tty", MODE="0666" KERNEL=="tty", GROUP="tty", MODE="0666" KERNEL=="tty[0-9]*", GROUP="tty", MODE="0620" KERNEL=="vcs|vcs[0-9]*|vcsa|vcsa[0-9]*", GROUP="tty" # serial KERNEL=="tty[A-Z]*[0-9]|pppox[0-9]*|ircomm[0-9]*|noz[0-9]*|rfcomm[0-9]*", GROUP="dialout" KERNEL=="mwave", GROUP="dialout" KERNEL=="hvc*|hvsi*", GROUP="dialout" # virtio serial / console ports KERNEL=="vport*", ATTR{name}=="?*", SYMLINK+="virtio-ports/$attr{name}" # mem KERNEL=="null|zero|full|random|urandom", MODE="0666" KERNEL=="mem|kmem|port|nvram", GROUP="kmem", MODE="0640" # input KERNEL=="mouse*|mice|event*", MODE="0640" KERNEL=="ts[0-9]*|uinput", MODE="0640" KERNEL=="js[0-9]*", MODE="0644" # video4linux SUBSYSTEM=="video4linux", GROUP="video" KERNEL=="vttuner*", GROUP="video" KERNEL=="vtx*|vbi*", GROUP="video" KERNEL=="winradio*", GROUP="video" # graphics KERNEL=="agpgart", GROUP="video" KERNEL=="pmu", GROUP="video" KERNEL=="nvidia*|nvidiactl*", GROUP="video" SUBSYSTEM=="graphics", GROUP="video" SUBSYSTEM=="drm", GROUP="video" # sound SUBSYSTEM=="sound", GROUP="audio" # DVB (video) SUBSYSTEM=="dvb", GROUP="video" # FireWire (firewire-core driver: IIDC devices, AV/C devices) SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x00010*", GROUP="video" SUBSYSTEM=="firewire", ATTR{units}=="*0x00b09d:0x00010*", GROUP="video" SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x010001*", GROUP="video" SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x014001*", GROUP="video" # libusb device nodes SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", MODE="0664" # printer KERNEL=="parport[0-9]*", GROUP="lp" SUBSYSTEM=="printer", KERNEL=="lp*", GROUP="lp" SUBSYSTEM=="ppdev", GROUP="lp" SUBSYSTEM=="usb", KERNEL=="lp*", SYMLINK+="usb%k", GROUP="lp" KERNEL=="lp[0-9]*", GROUP="lp" KERNEL=="irlpt[0-9]*", GROUP="lp" # hplip and cups 1.4+ use raw USB devices, so permissions should be similar to # the ones from the old usblp kernel module SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{ID_USB_INTERFACES}=="", IMPORT{program}="usb_id --export %p" SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{ID_USB_INTERFACES}=="*:0701*:", GROUP="lp", MODE="0664" # block SUBSYSTEM=="block", GROUP="disk" # floppy SUBSYSTEM=="block", KERNEL=="fd[0-9]", GROUP="floppy" # cdrom SUBSYSTEM=="block", KERNEL=="sr[0-9]*", SYMLINK+="scd%n", GROUP="cdrom" SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="4|5", GROUP="cdrom" KERNEL=="pktcdvd[0-9]*", GROUP="cdrom" KERNEL=="pktcdvd", GROUP="cdrom" # tape KERNEL=="ht[0-9]*|nht[0-9]*", GROUP="tape" KERNEL=="pt[0-9]*|npt[0-9]*|pht[0-9]*", GROUP="tape" SUBSYSTEM=="scsi_generic|scsi_tape", SUBSYSTEMS=="scsi", ATTRS{type}=="1|8", GROUP="tape" # block-related KERNEL=="sch[0-9]*", GROUP="disk" SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="0", GROUP="disk" KERNEL=="pg[0-9]*", GROUP="disk" KERNEL=="qft[0-9]*|nqft[0-9]*|zqft[0-9]*|nzqft[0-9]*|rawqft[0-9]*|nrawqft[0-9]*", GROUP="disk" KERNEL=="rawctl", GROUP="disk" SUBSYSTEM=="raw", KERNEL=="raw[0-9]*", GROUP="disk" SUBSYSTEM=="aoe", GROUP="disk", MODE="0220" SUBSYSTEM=="aoe", KERNEL=="err", MODE="0440" # network KERNEL=="tun", MODE="0666", OPTIONS+="static_node=net/tun" KERNEL=="rfkill", MODE="0644" # CPU KERNEL=="cpu[0-9]*", MODE="0444" KERNEL=="fuse", MODE="0666", OPTIONS+="static_node=fuse", \ RUN+="/bin/mount -t fusectl fusectl /sys/fs/fuse/connections" SUBSYSTEM=="rtc", DRIVERS=="rtc_cmos", SYMLINK+="rtc" KERNEL=="mmtimer", MODE="0644" KERNEL=="rflash[0-9]*", MODE="0400" KERNEL=="rrom[0-9]*", MODE="0400"
Chaque règle prend la forme suivante :
KEY, [KEY, …] NAME [, SYMLINK]
Chaque KEY est un champ au format type=valeur qui doit correspondre à un périphérique unique. La valeur de type peut prendre plusieurs formes :
Type | Description | Exemples |
---|---|---|
BUS | Type de bus | usb, scsi, ide |
KERNEL | Le nom par défault du périphérique donné par le noyau | hda, ttyUSB0, lp0 |
SUBSYSTEM | Le nom noyau du sous-système, généralement identique à la valeur du BUS | usb, scsi |
DRIVER | Le nom du pilote qui contrôle le périphérique | usb-storage |
ID | Le numéro du périphérique sur son bus | PCI bus id, USB id |
PLACE | Ne concerne que les périphériques USB et donne la position topologique du périphérique sur son bus | S/O |
SYSFS{filename} | Le nom du fichier dans /sys pour le périphérique. Ce fichier contient le fabricant, le label, le numéro de série et UUID du périphérique. La vérification de jusqu'à 5 fichiers est possible par règle | S/O |
PROGRAM | Ceci permet à Udev d'appeler un programme externe pour nommer un périphérique | S/O |
RESULT | Valeur à comparer au résultat de PROGRAM | S/O |
NAME et SYMLINK sont utilisées pour stipuler ce que Udev doit faire avec le périphérique :
Type | Description | Exemples |
---|---|---|
NAME | Le nome du nœud dans /dev | S/O |
SYMLINK | Le ou les lien(s) symbolique(s) qui pointe(nt) vers le NAME | S/O |
Pour obtenir de l'information sur un périphérique il convient d'utiliser la commande udevadm qui a remplacé la commande udevinfo disponible dans CentOS 5 :
opensuse:~ # udevadm info --query=all -n /dev/sda P: /devices/pci0000:00/0000:00:01.1/host1/target1:0:0/1:0:0:0/block/sda N: sda S: disk/by-id/ata-VBOX_HARDDISK_VB50f75dcc-537a53dd S: disk/by-id/scsi-SATA_VBOX_HARDDISK_VB50f75dcc-537a53dd S: disk/by-path/pci-0000:00:01.1-scsi-0:0:0:0 E: UDEV_LOG=3 E: DEVPATH=/devices/pci0000:00/0000:00:01.1/host1/target1:0:0/1:0:0:0/block/sda E: MAJOR=8 E: MINOR=0 E: DEVNAME=/dev/sda E: DEVTYPE=disk E: SUBSYSTEM=block E: ID_ATA=1 E: ID_TYPE=disk E: ID_BUS=ata E: ID_MODEL=VBOX_HARDDISK E: ID_MODEL_ENC=VBOX\x20HARDDISK\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20 E: ID_REVISION=1.0 E: ID_SERIAL=VBOX_HARDDISK_VB50f75dcc-537a53dd E: ID_SERIAL_SHORT=VB50f75dcc-537a53dd E: ID_ATA_WRITE_CACHE=1 E: ID_ATA_WRITE_CACHE_ENABLED=1 E: ID_ATA_FEATURE_SET_PM=1 E: ID_ATA_FEATURE_SET_PM_ENABLED=1 E: ID_SCSI_COMPAT=SATA_VBOX_HARDDISK_VB50f75dcc-537a53dd E: ID_PATH=pci-0000:00:01.1-scsi-0:0:0:0 E: ID_PART_TABLE_TYPE=dos E: UDISKS_PRESENTATION_NOPOLICY=0 E: UDISKS_PARTITION_TABLE=1 E: UDISKS_PARTITION_TABLE_SCHEME=mbr E: UDISKS_PARTITION_TABLE_COUNT=12 E: UDISKS_ATA_SMART_IS_AVAILABLE=0 E: DEVLINKS=/dev/disk/by-id/ata-VBOX_HARDDISK_VB50f75dcc-537a53dd /dev/disk/by-id/scsi-SATA_VBOX_HARDDISK_VB50f75dcc-537a53dd /dev/disk/by-path/pci-0000:00:01.1-scsi-0:0:0:0
La commande udevadm peut également être utilisée pour connaître toute l'information sysfs concernant un périphérique :
opensuse:~ # udevadm info -a -p /sys/class/input/mouse0/ Udevadm info starts with the device specified by the devpath and then walks up the chain of parent devices. It prints for every device found, all possible attributes in the udev rules key format. A rule to match, can be composed by the attributes of the device and the attributes from one single parent device. looking at device '/devices/platform/i8042/serio1/input/input1/mouse0': KERNEL=="mouse0" SUBSYSTEM=="input" DRIVER=="" looking at parent device '/devices/platform/i8042/serio1/input/input1': KERNELS=="input1" SUBSYSTEMS=="input" DRIVERS=="" ATTRS{name}=="ImExPS/2 Generic Explorer Mouse" ATTRS{phys}=="isa0060/serio1/input0" ATTRS{uniq}=="" ATTRS{modalias}=="input:b0011v0002p0006e0000-e0,1,2,k110,111,112,113,114,r0,1,6,8,amlsfw" looking at parent device '/devices/platform/i8042/serio1': KERNELS=="serio1" SUBSYSTEMS=="serio" DRIVERS=="psmouse" ATTRS{description}=="i8042 AUX port" ATTRS{modalias}=="serio:ty01pr00id00ex00" ATTRS{bind_mode}=="auto" ATTRS{protocol}=="ImExPS/2" ATTRS{rate}=="100" ATTRS{resolution}=="200" ATTRS{resetafter}=="5" ATTRS{resync_time}=="0" looking at parent device '/devices/platform/i8042': KERNELS=="i8042" SUBSYSTEMS=="platform" DRIVERS=="i8042" ATTRS{modalias}=="platform:i8042" looking at parent device '/devices/platform': KERNELS=="platform" SUBSYSTEMS=="" DRIVERS==""
Les options de la commande udevadm sont :
opensuse:~ # udevadm --help Usage: udevadm [--help] [--version] [--debug] COMMAND [COMMAND OPTIONS] info query sysfs or the udev database trigger request events from the kernel settle wait for the event queue to finish control control the udev daemon monitor listen to kernel and udev events test simulation run opensuse:~ # udevadm info --help Usage: udevadm info OPTIONS --query=<type> query device information: name name of device node symlink pointing to node path sys device path property the device properties all all values --path=<syspath> sys device path used for query or attribute walk --name=<name> node or symlink name used for query or attribute walk --root prepend dev directory to path names --attribute-walk print all key matches while walking along the chain of parent devices --device-id-of-file=<file> print major:minor of device containing this file --export export key/value pairs --export-prefix export the key name with a prefix --export-db export the content of the udev database --convert-db convert older version of database without a reboot --help
Le système de fichiers virtuel /sys a été introduit avec le noyau Linux 2.6. Son rôle est de décrire le matériel pour udev.
Saisissez la commande suivante :
opensuse:~ # ls -l /sys total 0 drwxr-xr-x 2 root root 0 Apr 9 15:38 block drwxr-xr-x 15 root root 0 Apr 9 15:38 bus drwxr-xr-x 41 root root 0 Apr 9 15:38 class drwxr-xr-x 4 root root 0 Apr 9 15:38 dev drwxr-xr-x 8 root root 0 Apr 9 15:38 devices drwxr-xr-x 5 root root 0 Apr 9 15:38 firmware drwxr-xr-x 4 root root 0 Apr 10 09:23 fs drwxr-xr-x 5 root root 0 Apr 9 15:38 kernel drwxr-xr-x 97 root root 0 Apr 9 15:38 module drwxr-xr-x 2 root root 0 Apr 9 15:38 power
Chaque répertoire contient des informations :
Pour illustrer ceci, saisissez la commande suivante :
opensuse:~ # cat /sys/block/sda/sda1/size 223232
Ce chiffre correspond aux nombre de secteurs.
Les ressources disponibles aux utilisateurs peuvent être limitées par l'utilisation de la commande ulimit.
La commande ulimit gère deux types de limite, la limite hard en utilisant l'option -H et la limite soft en utilisant l'option -S. Seul root peut positionner une limite hard et ceci à condition que la limite ne dépasse pas les ressources réelles.
La limite soft est la limite imposée à l'utilisateur par défaut tandis que la limite hard est la limite que l'utilisateur peut atteindre en utilisant la commande ulimit lui-même.
L'utilisateur root peut paramétrer les limites accordées en éditant la fichier /etc/security/limits.conf :
opensuse:~ # cat /etc/security/limits.conf # /etc/security/limits.conf # #Each line describes a limit for a user in the form: # #<domain> <type> <item> <value> # #Where: #<domain> can be: # - an user name # - a group name, with @group syntax # - the wildcard *, for default entry # - the wildcard %, can be also used with %group syntax, # for maxlogin limit # #<type> can have the two values: # - "soft" for enforcing the soft limits # - "hard" for enforcing hard limits # #<item> can be one of the following: # - 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 files # - 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 # #<domain> <type> <item> <value> # #* soft core 0 #* hard rss 10000 #@student hard nproc 20 #@faculty soft nproc 20 #@faculty hard nproc 50 #ftp hard nproc 0 #@student - maxlogins 4 # End of file
<note important> La valeur de la limite peut être un nombre ou le mot unlimited. </note>
Par exemple, si root inscrit les deux ligne suivantes dans le fichier /etc/security/limits.conf :
... trainee soft nofile 1024 trainee hard nofile 4096 ...
la limite du nombre de fichiers ouverts simultanément par trainee est de 1 024. Par contre, trainee a la possibilité d'augmenter cette limite jusqu'à 4 096 en utilisant la commande suivante :
$ ulimit -n 4096
Pour consulter la liste des limites actuelles, il convient d'utiliser la commande ulimit avec l'option -a :
root@debian:~# ulimit -a core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 16382 max locked memory (kbytes, -l) 64 max memory size (kbytes, -m) unlimited open files (-n) 1024 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0 stack size (kbytes, -s) 8192 cpu time (seconds, -t) unlimited max user processes (-u) unlimited virtual memory (kbytes, -v) unlimited file locks (-x) unlimited
<note important> openSUSE ne fournit pas d'information (ni help, ni man, ni info) concernant la commande ulimits. Les informations suivantes sont celles de CentOS/Redhat. </note>
Les options de ulimit sont :
[root@centos ~]# help ulimit ulimit: ulimit [-SHacdefilmnpqrstuvx] [limit] Modify shell resource limits. Provides control over the resources available to the shell and processes 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's data segment -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 -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 If LIMIT is given, it is the new value of the specified resource; the special LIMIT values `soft', `hard', and `unlimited' stand for the current soft limit, the current hard limit, and no limit, respectively. Otherwise, the current value of the specified resource is printed. If 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.
~~DISCUSSION:off~~
{(rater>id=opensuse_11_l117|name=cette page|type=rate|trace=user|tracedetails=1)}