Service Management/disk boot area recovery notes, disk boot

Source: Internet
Author: User

Service Management/disk boot area recovery notes, disk boot

Linux running level:

 

System Service: Provides running programs with some resident features. These programs are often running in memory. The service name is followed by a d letter.

Independent services and non-independent services?

Independent Service: the service is started independently and resident in the memory. It runs fast.

Non-independent service: the socket or port management provided by the xinted management program. It starts the corresponding service program as required by the user, and closes the program after the request ends.

 

Early service launch: The init script program management feature of SysV.

  • Switch the execution level:
  • INIT process: the/sbin/init program is the first process in the system, and the PID (process mark) is always 1;

    Configure the default execution level:

  • Other system initialization files:

    /Etc/rc. d/rc. sysinit

    • Called and executed by the init process

    • Complete network setting, host name setting, file system loading, and other initialization work

    /Etc/rc. d/rc Script File

    • Called and executed by the init process

    • Load or terminate corresponding system services based on the specified running level

    /Etc/rc. local script file

    • Called and executed by rc scripts

    • Saves user-defined commands that need to be automatically executed after startup

  •  

    CentOS 7.x's new startup Service Management Mechanism systemd:

     

    What is the difference between service restart and reload?

     

    Several Common commands that often look at process information:

    Ps:

    Ps aux: displays information about all current processes;

    Top: displays the dynamic information of all processes. (Press e to view the multi-core CPU, and press q to exit)

    Preg: view the process terminal number (process ID ).

     

    Pstree-aup: displays the process tree and the sub-process (name and ID) of the process ).

     

    Nice: Adjust the priority of the process. The priority adjusted for the root user is between-20 and 20, and the normal user is only between 0 and 20.

    Renice: dynamically adjusts the process priority. (In the example,-5 is the priority to be adjusted, and-p is the ID of the adjusted process)

     

    How to run the program in the background and transfer the background program to the foreground:

     

    Ctrl + Z combination key: suspends the current process, that is, it is transferred to the background and stops execution;

    Jobs: view the commands run in the background;

    Fg: restores the background process to the foreground. You must specify the task serial number;

    Sleep: delay the current action to a period of time, followed by s \ m \ h \ d (seconds, minutes, hours, days ).

     

    Process Termination:

    Ctrl + C

    Kill:

    Killall:

    Pkill: Kill a logon user.

     

    Scheduled task management:

    At: one-time task execution.

    Example:

    At // set shutdown

    At> shut down-h now

    At> <EOT> // Ctrl + D Terminator

    View and delete a one-time task:

     

    Crontab task:

    Format: minute hour day month week <Execute Command>

    Special Representation of time values:

    *: Any time of access range

    ,: Indicates the interval between multiple discontinuous time points.

    -: Indicates a continuous time point.

    /: Time Frequency of the specified interval

    Example:

    Crontab-e: root editing Task Mode

    Crontab-e-u admin: The task is edited and executed by the admin user.

    Crontabl-l: the root user can view the scheduler task list.

    Crontabl-l-u admin: View and delete the scheduled tasks set by the admin user.

    Restrict users using crontabl:

     

     

     

     

    Backup MBR boot zone:

    Simulate damage to MBR boot zone:

    Use the centos disc to enter the recovery mode, mount the backup disk under the shell, restore the MBR, and restart:

     

    How to restore the grub boot configuration file:

    (1) simulate the destruction of grub Configuration:

    (2) After the restart, enter the boot command at the grub prompt to enter the system:

    (3) restore the grub. conf file.

     

    Method 2: (boot with a CD)

    (1) Go to the shell Interface guided by the CD and use chroot to mount the boot directory of sda1:

    (2) mount the backup disk and restore the grub. conf file:

    (3) Exit shell and restart:

     

    How to restore the corrupted grub program:

    (2) simulate damage:

    (3) CD boot:

    (4) restore from backup:

    If there is no backup, use the following method to fix it after the disc is started:

     

    The root password is missing:

    Select the 2nd-item-kernel option, and then press "e" to edit the menu item:

    In edit mode, enter space + 1 after the command:

    Return to the menu item, press B to restart, and enter the single-user mode:

    Directly change the root password and restart:

     

    Failed to write or read content to the partition:

    The simulated partition has been damaged:

    A file system error is prompted during startup:

    Fsck command fix:

    Restart.

     

    If the disk I file node is used up:

    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.