Day 7 Linux system monitoring, hard disk partitioning, etc.

Source: Internet
Author: User
Tags format definition disk usage

System monitoring of Linux system monitoring, hard disk partition, etc.
  1. System monitoring and Process control tools-top and free
    1) Mastering the function of the top command: The top command is a common performance analysis tool under Linux that shows the resource usage of each process in the system in real time, similar to the Task Manager of Windows.
    2) Learn to list the system state using the top command, the system defaults to refresh the display on the screen every 5 seconds.

    1. The first line is the task queue information
    14:54:36 Current Time
    Up 3:42 system Run time (hours: minutes)
    3 Users currently logged on
    Load average:0.03 0.05 0.10
    System load. Three values are 1 minutes, 5 minutes, 15 minutes ago to the present average
    2. Second to third behavioral process and CPU information
    tasks:169 Total Process Totals
    1 running number of running processes
    168 sleeping The number of sleep processes
    0 Number of processes stopped stopped
    0 Zombie Number of zombie processes
    CPU (s): 0.3% US user space consumes CPU percentage
    0.7 sy core space CPU percent occupied
    0.0% CPU Percentage of processes that have changed priority within NI user process space
    98.6% ID Idle CPU percent
    0.3% wa wait for the input output CPU time percentage
    0.0% hi hardware interrupts% of CPU time
    0.0% Si software interrupts the percentage of CPU time consumed
    3.45th Behavior Memory information.

    4. Process information
    PID Process ID
    PPID Parent Process ID
    Ruser Real User Name
    User ID of the UID process owner
    Username of user Process Owner
    Group Process Owner's name
    The terminal name of the TTY startup process. Processes that are not started from the terminal are displayed as?
    PR-Priority
    NI nice value. Negative values indicate high priority, positive values indicate low priority
    P last used CPU, only meaningful in multi-CPU environment
    %cpu percentage of CPU time that was last updated to current
    The total CPU time, in seconds, used by the duration process
    Total CPU time used by the time+ process, Unit 1/100 sec
    Percentage of physical memory used by the%MEM process
    The total amount of virtual memory used by the VIRT process, in kilobytes. Virt=swap+res
    The swap process uses the amount of virtual memory that is swapped out, in kilobytes.
    The size, in kilobytes, of the physical memory used by the RES process and not swapped out. Res=code+data
    The amount of physical memory the code executable consumes, in kilobytes per kb
    The amount of physical memory that is used outside the data executable code (segment + stack), in kilobytes
    SHR shared memory size, in kilobytes
    Nflt Number of page faults
    NDRT the number of pages that were modified the last time it was written to.
    S process state.
    d= non-disruptive sleep state
    R= Run
    S= Sleep
    t= Tracking/Stopping
    z= Zombie Process
    Command name/command line
    Wchan If the process is sleeping, the system function name in sleep is displayed
    Flags task flag, reference sched.h
    3) Master the function of the free command: Displays the memory usage status.
    Cento7 Display As

    CENTO6 Display As

    Release the data that was consumed by the system cache:
    Echo 3>/proc/sys/vm/drop_caches
  2. Monitoring-ps of processes in the system
    1) Process definition: A process is a dynamic execution of a program.
    2) Daemon definition: daemons are some processes that run in the background and provide system services.
    3) Definition of parent and child processes: When a process creates another process, the 1th process is called the parent process of the new process, and the new process is called a child process.
    4) PS Command function: Used to display the status of the current process.
    Ps–aux Show all the user-related complete information
    Monitoring of processes in the system pstree, kill
    Centos7 default no Pstree, requires yum-y install Psmisc
Hard disk partitioning, formatting, and file system management one
  1. The correspondence between the hardware device and the file name
    1) in a Linux system, each device is treated with a single file.
    2) file names for various devices in Linux
  2. Structure of hard disk and partition of hard disk
    1) Why to partition the hard disk:
    A) easier to manage and control the system because the relevant files and directories are placed in a single partition.
    b) The system is more efficient.
    c) can limit the user's share of the hard disk (the size of the disk space).
    d) Easier backup and recovery.
    2) The logical structure of the hard disk:
    A hard drive can logically be divided into blocks, tracks, magnetic columns, and partitions.
    3) block definition: A block is the smallest unit of addressing (access) on a platter, and a block can store data of a certain byte.
    4) Definition of track: The track is a circle of a series of connected pieces of the tail.
    5) Magnetic column definition: The magnetic column is composed of a stack of tracks, by the same radius on each disc surface of the track.
    6) Definition of partition: The partition is composed of a group of adjacent magnetic columns.
  3. Partitioning of hard disks in Linux systems
    1) Classification of hard disk partition: The partition of hard disk can be divided into primary partition, extended partition and logical partition.
    2) Number of primary partitions: a maximum of 4 primary partitions can be divided on one hard disk.
    3) The Linux operating system's kernel supports a limited number of partitions on each hard drive, and the Linux kernel can support up to a maximum on each hard disk:
    A) Divide 15 partitions (partitions) on the SCSI hard disk.
    b) Divide 63 partitions (partitions) on the IDE hard disk.
  4. Use the Fdisk and Partprobe commands to manage hard disk partitions
    1) The function of the FDISK command: Create a disk partition.
    2) commands commonly used in the FDISK command list:
    A) D: Delete an (already existing) partition, where D is the 1th letter of the Delete.
    b) L: Lists the type of partition (already existing), where L is the 1th letter of the list.
    c) m: Lists all commands used in Fdisk, where M is the 1th letter of the menu.
    d) N: Add a new partition where n is the 1th letter of new.
    e) P: Lists the contents of the partitioned table, where p is the 1th letter of print.
    f) Q: Exit Fdisk, but do not store the changes, where Q is the 1th letter of quit.
    g) T: Change the ID of the partition system, where T is the 1th letter of the title.
    h) W: Exit Fdisk and store the changes, where W is the 1th letter of write.
    3) function of the Partprobe command: Re-initialize the partition table of the kernel in memory.
  5. Creating a file system
    1) format definition: The so-called format is to partition the hard disk space into a number of equal size data block (Blocks), and set the partition of how many I nodes can be used and so on.
    2) file system definition: The file system is the method and data structure used by the operating system to clear the files on a disk or partition; that is, the method of organizing files on disk.
    3) commonly used file system types
    Standard file systems in the Ext2:linux system
    Ext3: A log-file system
    EXT4: An extended journaled file system for EXT3 systems
    LVM: Logical Disk Volume management
    ISO9660: The only universal Disc File system available
    4) Function of MKFS command: Format disk.
    5) Apply the commonly used formatting commands:
    Mkfs. File system Type
    For example, the command to format a partition/dev/sdb1 as a EXT4 file system is:
    Mkfs.ext4/dev/sdb1
  6. Set a label for a partition
    1) function of the E2label command: Set or view the label name of a device.
    2) Apply the E2label command to set the label:
    A) For example: The command to view the label of the/DEV/SDB1 partition is:
    E2label/dev/sdb1
    b) For example: Set the label of the/DEV/SDB1 partition to the command of the WG:
    E2LABEL/DEV/SDB1 WG
Partition of hard disk, format and management of file system two
    1. File system mount and unload (see Linux System Management P406)
      1) Master the definition of Mount: Mount refers to a device (typically a storage device) that is attached to an existing directory.
      2) Master the function of the Mount command: Implement file system mount.
      3) flexibly apply mount command to mount the file system:
      For example: Mount the/DEV/SDB1 partition to a command on the/WG directory:
      Mount/dev/sdb1/wg
      4) Master the function of the Umount command: the implementation of the file system uninstall.
      5) Flexible application of the Umount command to implement file system uninstallation:
      For example, the command to uninstall the file system on/WG:
      Umount/wg
    2. Virtual memory concepts and settings and management (see Linux System Management P414)
      1) Definition of virtual memory: the so-called virtual memory is a piece of hard disk space is used as memory, also known as swap partition (swap).
      2) The type of Linux swap partition is: 0x82
      3) function of the Mkswap command: Set the swap partition.
      4) Use the Mkswap command to set up an example of swap partition usage:
      Example: the command to set partition/DEV/SDB2 to swap partition: MKSWAP/DEV/SDB2
      5) function of the Swapon command: Start the swap partition.
      6) function of the Swapon–a command: Start all swap partitions.
      7) function of the Swapon–s command: Lists the status of all system swap partitions that are currently in use.
      8) Examples of usage of the Swapon command:
      For example: Enable the Swap partition/DEV/SDB2 command: SWAPON/DEV/SDB2
    3. I node (see Linux System Management P170)
      1) I node definition: I node is actually a data structure that holds basic information about an ordinary file, directory, or other file system object.
    4. Symbolic (soft) links (see Linux System Management P174)
      1) Definition of symbolic Link: a symbolic link is a file that points to another file.
      2) An example of the use of the LN command to create a soft connection:
      A) Create a dog_ wolf.boy symbolic link to the Wolf/dog.wolf.baby file and place the command in the Bodydog directory:
      Ln–s Wolf/dog.wolf.baby Bodydog/dog_ Wolf.boy
    5. Hard links (see Linux System Management P179)
      1) The definition of a hard link: A hard link is a file name and an I-node correspondence between, can also be considered a hard link to the corresponding file added an additional path name.
      2) The LN command creates a hard-connect usage Example:
      A) Create a hard-link command named WOLF.DOG2 in the backup directory for the Wolf/wolf.dog file:
      ln Wolf/wolf.dog BACKUP/WOLF.DOG2
    6. Types of files in Linux systems (see Linux System Management P183)
      1) Common types of files in Linux systems:
      -: Normal files (regular file), also known as regular files.
      D: catalog (directory).
      L: symbol (soft) link.
      B: Block Special file (b is the 1th character of Block), generally refers to block device, such as hard disk.
      C: Character special file (c is the 1th character of character), generally refers to a character device, such as a keyboard.
    7. How to check disk space (see Linux System Management P185)
      1) function of the DF command: Displays the number of disk usage and idle areas in the file system.
      -A Show All disks
      -H Unit conversion
      2) function of the du command: Displays the directory and file size a h ibid.

Day 7 Linux system monitoring, hard disk partitioning, etc.

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.