Article From:https://www.cnblogs.com/honglingjin/p/9215443.html

1.View disk analysis commands

  1. df -hl View the remaining space of the disk
  2. df -h View the partition size of each root path
  3. du -sh [Directory name] return the size of the directory
  4. du -sm [Folder] return the total M number of the folder
  5. df –help Look at more functions
View the partition of the hard disk #sudo fdisk -l  
Look at the IDE hard disk information #sudo hdparm-i /dev/hda  
Look at the STAT hard disk information #sudo hdparm-I /dev/sda Or #sudo apt-get install blktool #sudo blktool /dev/sda id  
View the remaining space of the hard disk #df-h #df -H  
Look at the directory occupancy space #du-hs Directory name#sync fuser can not be unloaded by the good disk-km /media/usbdisk  

2.Resource occupancy

top:

main parameterD: specify the interval for updates, calculated in seconds.Q: there is no delay in updating. If the user has a super user, the top command will be executed with the highest priority.C: displays the complete path and name of the process.S: cumulative pattern, will beThe CPU time of the completed trip has been accumulated.S: security mode.I: do not show any idle (Idle) or useless (Zombie) trips.N: displays the number of updates and will exit to after completion.Display parameters:PID (Process ID): process marking number.USER: the user name of the process owner.PR: the priority level of the process.NI: the priority level value of the process.VIRT: the virtual memory value that the process takes up.RES: the physical memory value of the process.SHR: shared memory values used by the process.S: the state of the process, where S means dormancy, R means running, Z means dead state, and N indicates that the process priority is negative.%CPU:The CPU usage rate used by the process.%MEM:The percentage of physical memory and total memory occupied by the process.Ti e +: the total CPU time occupied after the process starts.Command: the name of the startup command that the process starts. If the row is not displayed, the process will have a complete command line.TopcommandSpace: refresh immediately.P: sort according to the size of the CPU.T: sort according to time and accumulative time.Q: exit the top command.M: switch to display memory information.T: switch the display process and the CPUState information.C: switch the name of the display command and the complete command line.M: sort by using memory size.W: write the current settings~/.toprcIn the document. This is the recommended method for writing top configuration files.Free1.EffectThe free command is used to display the usage of memory, and the permissions are all users.2.formatFree [b - K M] [[-] delay3.main parameterB - k m: the use of bytes (KB, MB) in units is shown separately.S delay: shows how many times the number of seconds is used to display memory usage.- t: displays the sum of memory.- O: no delayAdjust the column in the punching zone.Uptime18:59:15 up 25 min, 2 users, load average: 1.231.321.21

Time nowThe time that the system starts running to the presentThe number of users on the lineOne minute, five minutes and fifteen minutes of system load.Parameters:-V Display version information.VmstatProcs-----------memory---------- ---swap-- -----io---- --system-- ----cpu----

r b swpd free buff cache si so bi bo in cs us sy id wa

0 1 24980 10792 8296 47316 5 19 205 52 1161 698 26 3 1 70

1 Watch disk activityDisk activity is mainly learned from the following indicators:Bi: the number of blocks read from disk per second (blocks/s)。The larger the number, the more active it is to read the disk.Bo: the number of blocks written to disk per second (blocks/s)。The larger the number, the more active the disk is.Wa:cpu wait for the time ratio of disk I / O (pending disk IO). The larger the number, the more serious the file system activity blocks CPU, because CPU is waiting for the slow disk system to provide data. Wa is 0.I think. If Wa is often greater than 10, it may be necessary for the file system to perform performance tuning.2 Observe the activity of CPUVmstat is more capable of reflecting the use of CPU than top:Us: the time ratio of the user program to use CPU. The larger the number, the more busy the user process.SY: the system call uses the time ratio of CPU. Be carefulBecause NFS is running inside the kernel, the CPU time occupied by NFS activity is reflected in sy. If this number is often large, we need to pay attention to whether or not a kernel process, such as NFS task, is rather heavy. If US and sy are both large at the same time, they will need to considerSome user programs are separated from other servers to avoid interaction.The free time ratio of id:cpu.Wa:cpu waits for the time ratio of the unresolved disk IO.IostatUse of statistical CPU and TTYPreparation, hard disk and CD-ROMI/0amountParameters:-c Only the CPU line is displayed-d Display disk line-k Display disk output in a thousand bytes-t A timestamp is included in the output-x The extended disk index is included in the outputAVG-cpu: %user %nice %sys %iowait %idle

20.25 0.18 2.61 76.39 0.57

%iowait Wait for local I/OThe percentage of CPU idle time%idle No waiting for local I/OThe percentage of CPU idle timeDevice:tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn

hda 9.86 284.34 84.48 685407 2036

The number of transmission per second (TPS) and the 512 byte reads per second (Blk_read/s)、The total number of blocks per byte (Blk_wrtn/s) and 512 byte block read (Blk_read) and write (Blk_wrtn) per second is 512 byte.

 

Leave a Reply

Your email address will not be published. Required fields are marked *