One Linux command per day (iostat) command

Source: Internet
Author: User
Tags disk usage telnet program

The IOSTAT is an abbreviation for I/O statistics (input/output statistics) that monitors the system's disk operation activity. It is characterized by the reporting of disk activity statistics, as well as the reporting of CPU usage.

(1) Usage:

usage: iostat [parameter] [TIME] [times]

(2) function:

function: can provide richer IO performance status data,

Through the Iostat convenient to view the CPU, network card, TTY device, disk, CD-ROM and so on the activity of equipment, load information.

Like Vmstat, Iostat also has a weakness, that is, it cannot analyze a process in depth, only the overall situation of the system. Iostat belongs to the Sysstat package. Can be installed directly with Yum install Sysstat.

(3) Option parameters:

1)-c Display of CPU usage

2)-D display disk usage

3)-K is displayed in kilobytes

4)-m display in m units

5)-N Display of disk array (LVM) information

6)-X display details

(4) Example:

1) [[email protected] sunjimeng]# Iostat Show all device load conditions

[email protected] sunjimeng]# Iostatlinux3.10.0-229. el7.x86_64 (Localhost.localdomain) June 07, 2016 _x86_64_ (2CPU) Avg-CPU:%user%nice%system%iowait%steal%Idle1.58    0.00    0.92    0.04    0.00   97.47Device:tps Kb_read/s kb_wrtn/s Kb_read kb_wrtnsda0.57        11.80         2.13     419482      75552

Equivalent to:

[Email protected] sunjimeng]# iostat-c-Dlinux3.10.0-229. el7.x86_64 (Localhost.localdomain) June 07, 2016 _x86_64_ (2CPU) Avg-CPU:%user%nice%system%iowait%steal%Idle1.55    0.00    0.89    0.04    0.00   97.52Device:tps Kb_read/s kb_wrtn/s Kb_read kb_wrtnsda0.53        10.92         2.00     419506      76803

Parameter description:

1.cpu Value Property Description:

%user:cpu the percentage of time in user mode.

%nice:cpu the percentage of time in user mode with nice value.

%system:cpu the percentage of time in system mode.

%iowait:cpu the percentage of time to wait for the input output to finish.

%steal: The percentage of the virtual CPU's unconscious wait time when the hypervisor maintains another virtualized processor.

%IDLE:CPU idle time percentage.

Note: If the value of%iowait is too high, indicating that there is an I/O bottleneck on the hard disk, high%idle value, indicating that the CPU is idle, if the%idle value is high but the system responds slowly, it is possible that the CPU waits for memory allocation, and the memory capacity should be increased. If the%idle value continues below 10, the system's CPU processing power is relatively low, indicating that the most resource to be addressed in the system is the CPU.

2.disk Value Property Description:

TPS: The number of transmissions per second of the device (indicate, transfers per second, were issued to the.). "One-time transfer" means "one-time I/O request". Multiple logical requests may be merged into "one I/O request". The size of the "one transfer" request is unknown.

KB_READ/S: The amount of data read from the device (drive expressed) per second;

KB_WRTN/S: The amount of data written to the device (drive expressed) per second;

Kb_read: The total amount of data read;

KB_WRTN: The total amount of data written;

These units are in kilobytes.

2) [[email protected] sunjimeng]# Iostat 1 3 once per second, total 3 times

[Email protected] sunjimeng]# Iostat1 3Linux3.10.0-229. el7.x86_64 (Localhost.localdomain) June 07, 2016 _x86_64_ (2CPU) Avg-CPU:%user%nice%system%iowait%steal%Idle1.56    0.00    0.89    0.04    0.00   97.51Device:tps Kb_read/s kb_wrtn/s Kb_read kb_wrtnsda0.55        11.25         2.05     419502      76249avg-CPU:%user%nice%system%iowait%steal%Idle4.10    0.00    2.05    0.00    0.00   93.85Device:tps Kb_read/s kb_wrtn/s Kb_read kb_wrtnsda3.96         0.00        13.37          0          -avg-CPU:%user%nice%system%iowait%steal%Idle7.10    0.00    2.19    0.00    0.00   90.71Device:tps Kb_read/s kb_wrtn/s Kb_read kb_wrtnsda0.00         0.00         0.00          0          0

3) [[email protected] sunjimeng]# iostat-x show more details

[Email protected] sunjimeng]# Iostat-Xlinux3.10.0-229. el7.x86_64 (Localhost.localdomain) June 07, 2016 _x86_64_ (2CPU) Avg-CPU:%user%nice%system%iowait%steal%Idle1.55    0.00    0.89    0.04    0.00   97.53DEVICE:RRQM/s wrqm/s r/s w/s rkb/s wkb/s avgrq-sz avgqu-sz await r_await w_await SVCTM%UTILSDA0.02     0.03    0.31    0.23    11.16     2.03    48.66     0.02   40.03   10.06   79.52   3.87   0.21

RRQM/S: How much of this device-dependent read request is merged per second (when the system call needs to read the data, the VFS sends the request to each FS, and if FS finds that different read requests read the same block data, FS merges the request into the merge);

WRQM/S: How much of this device-related write request is being merge per second.

RSEC/S: Number of sectors read per second; wsec/: Number of sectors written per second.

R/s:the number of read requests that were issued to the device per second;

W/s:the number of write requests that were issued to the device per second;

Await: The average time (in milliseconds) for each IO request to be processed. This can be understood as the response time of IO, generally the system IO response time should be less than 5ms, if greater than 10ms is relatively large.

%util: All processing io time, divided by total statistic time, in the statistical time. For example, if the statistic interval is 1 seconds, the device has 0.8 seconds to process Io, and 0.2 seconds is idle, then the device's%util = 0.8/1 = 80%, so this parameter implies the device's busy level. Generally, if this parameter is 100% indicates that the device is already running close to full load (of course if it is a multi-disk, even if%util is 100% because of the concurrency of the disk, disk usage may not be the bottleneck).

4) [[email protected] sunjimeng]# iostat-c show the status value of some CPUs

[Email protected] sunjimeng]# Iostat-3.10. 0-229. el7.x86_64 (localhost.localdomain)     June 07, 2016     _x86_64_    (2  CPU) Avg-cpu:  %user   %nice%system%iowait  %steal   %idle           1.54    0.00    0.89    0.04    0.00   97.53

5) [[email protected] sunjimeng]# iostat-d show the status value of some disk

[Email protected] sunjimeng]# Iostat-3.10. 0-229. el7.x86_64 (localhost.localdomain)     June 07, 2016     _x86_64_    (2  CPU) Device:            TPS    kb_read/s    kb_wrtn/s    kb_read    kb_wrtnsda               0.54         11.00         2.01     419502      76703

6) [[email protected] sunjimeng]# iostat-t display TTY and CPU information

[Email protected] sunjimeng]# Iostat-Tlinux3.10.0-229. el7.x86_64 (Localhost.localdomain) June 07, 2016 _x86_64_ (2CPU) June 07, 2016 02:20 31 second AVG-CPU:%user%nice%system%iowait%steal%Idle1.55    0.00    0.89    0.04    0.00   97.52Device:tps Kb_read/s kb_wrtn/s Kb_read kb_wrtnsda0.53        10.88         2.01     419506      77323

(5) Other:

Linux terminal TTY:

A terminal is a type of character device that has many types, usually using a TTY for short-range end devices. TTY is the abbreviation for teletype. Teletype is one of the first terminal equipment, much like a telex typewriter (or ","), is produced by Teletype company. The device name is placed in the special file directory/dev/, the terminal special equipment files generally have the following kinds:
1. Serial port terminal (/DEV/TTYSN)
The serial port terminal (Serial Port Terminal) is a terminal device connected using a computer serial port. The computer sees each serial port as a character device. For a while these serial port devices are often referred to as end-device, because it is used to connect the terminal at that time. The serial ports corresponding to the device name is/dev/tts/0 (or/DEV/TTYS0),/DEV/TTS/1 (or/dev/ttys1), etc., the device number is (4,0), (4,1), respectively, corresponding to the DOS system COM1, COM2 and so on. To send data to a port, you can redirect standard output to these special file names on the command line. For example, at the command-line prompt, type: Echo Test >/dev/ttys1 will send the word "test" to the device connected to the TtyS1 (COM2) port.
2. Pseudo-terminal (/dev/pty/)
Pseudo-terminal (Pseudo Terminal) is a paired logical terminal device, such as/DEV/PTYP3 and/DEV/TTYP3 (or/dev/pty/m3 and/DEV/PTY/S3 in the device file system, respectively). They are not directly related to the actual physical device. If a program considers TTYP3 as a serial port device, its read/write operation on the port is reflected in the other upper (TTYP3) of the logical terminal pair. The TTYP3 is a logical device that another program uses for read and write operations. In this way, two programs can communicate with each other through this logical device, and one of the programs that uses TTYP3 thinks that it is communicating with a serial port. This is like a pipe operation between logical device pairs.
For TTYP3 (S3), any program designed to use a serial port device can use the logical device. However, for programs that use PTYP3, you need to specifically design a ptyp3 (m3) logical device.
For example, if someone uses the Telnet program to connect to your computer on the Internet, the Telnet program may start connecting to the device Ptyp2 (m2) (on a pseudo-terminal port). At this point a Getty program should run on the corresponding TTYP2 (S2) port. When Telnet obtains a character from the far end, the character is passed to the Getty program via M2, S2, and the Getty program returns the "login:" String information to the network via S2, M2, and Telnet programs. In this way, the login program communicates with the Telnet program through a "pseudo-terminal". By using the appropriate software, two or more pseudo-terminal devices can be connected to the same physical serial port.
Prior to the use of device filesystem, HP-UX AIX used more complex file name naming methods in order to obtain a large number of special files for pseudo-terminal devices.
3. Control Terminal (/dev/tty)
If the current process has a control terminal (controlling Terminal), then/dev/tty is the device special file for the control terminal of the current process. You can use the command "Ps–ax" to see which control terminal the process is connected to. For your login Shell,/dev/tty is the terminal you use, the device number is (5,0). Use the command "TTY" to see which actual terminal device it corresponds to. The/dev/tty is similar to a connection to a terminal device that is actually used.
4. Console Terminal (/dev/ttyn,/dev/console)
In UNIX systems, computer monitors are often referred to as console terminals (consoles). It simulates a type of Linux terminal (Term=linux), and there are some device special files associated with it: Tty0, Tty1, Tty2, and so on. When you log in on the console, you are using Tty1. When using ALT+[F1-F6], we can switch to Tty2, Tty3, and so on. Tty1–tty6 is called a virtual terminal, and Tty0 is an alias of the virtual terminal that is currently used, and the information generated by the system is sent to the terminal. Therefore, regardless of which virtual terminal is currently in use, the system information is sent to the console terminal.
You can log in to a different virtual terminal, which allows the system to have several different session periods at the same time. Only the system or Superuser root can write to/dev/tty0,
5. Other types
Also for many different character devices exist there are many other kinds of terminal equipment special files. For example,/dev/ttyin terminal equipment for ISDN devices. Don't repeat it here.

2.LVM:

LVM is shorthand for Logical Volume Manager (Logical Volume management), which is a mechanism for managing disk partitions in a Linux environment.

Built a VG, there are 3 logical volumes, one of which I divided 100m, but I have a copy of a 300m file, why can I succeed?

LVM is a bit like a dynamic disk under Windows, because LVM dynamically adjusts the size of the logical volume. In fact, the concept of LVM volume according to the usual partitioning is on the same partition, each LVM volume can be dynamically extended to the entire partition size, as long as three logical volumes used space and less than the size of the partition, then you can continue to copy files on any LVM volume.

One Linux command per day (iostat) command

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.