RHCE (REDHAT7) (iii)

Source: Internet
Author: User

RHCE (REDHAT7)(iii)

First, the configuration of soft RAID (MDADM)

Mdadm system will be installed automatically, do not need additional installation

# mdadm-c/dev/md1-a yes-l1-n2/dev/sdb1/dev/sdb2 ( note 1 is preceded by the letter L,1 represents raid1, 2 for 2 fast drives )

View information:

# mdadm-d/DEV/MD1

generate the configuration file (otherwise, the server restarts the soft RAID is disabled):

# Mdadm-ds >/etc/mdadm.conf

# MKFS.XFS/DEV/MD1

# MOUNT/DEV/MD1/AA (so it can be used, can be written into the/etc/fstab )

Disable Soft RAID:

# mdadm-s/DEV/MD1

Enable Soft RAID:

# mdadm-a/DEV/MD1

Second, Lvm

Create a physical volume group first:

# PVCREATE/DEV/SDB1

Then create a logical volume group:

# vgcreate VG0/DEV/SDB1 (default PE is 4M)

# vgcreate–s 8M vg0/dev/sdb1 (You can specify a PE size of 8M at creation time)

To view the physical Volume Group command:

# Pvscan

To view the logical Volume Group command:

# Vgdisplay Vg0

To delete a physical volume Group command:

# PVREMOVE/DEV/SDB1

To delete a logical Volume Group command:

# Vgremove Vg0

Create a partition of size 200M/dev/vg0/lv01:

# lvcreate–l 200M–N/DEV/VG0/LV01

Create a partition/dev/vg0/lv01(that is, 200x4m)with a size of five PE sizes :

# lvcreate–l 200–N/DEV/VG0/LV01

To view partitions:
# Lvscan

Format the partition ( after mount can be used normally):

# MKFS.XFS/DEV/VG0/LV01

Zoom to 400M:

# lvextend–l 400M–N/DEV/VG0/LV01

added 400M:

# lvextend–l +400M–N/DEV/VG0/LV01

Add a few more PE:

# lvextend–l +50–N/DEV/VG0/LV01

To deactivate a lv01 partition:

# LVCHANGE–AN/DEV/VG0/LV01

reduce partition to 300M(first deactivate partition):

# lvreduce–l 300M–N/DEV/VG0/LV01

Enable lv01 partition:

# LVCHANGE–AY/DEV/VG0/LV01

To add a physical volume:

# Vgextend VG0/DEV/SDB2

To delete a physical volume:

# Vgreduce VG0/DEV/SDB2

Data migration:

# pvmove–i 3/DEV/SDB1/DEV/SDB2 ( sdb1 data is moved to Sdb2 ,3 seconds to refresh once)

Create a snapshot (set the 20% size to Prime ):

# lvcreate–l 40M–N/DEV/VG0/LV01_SNAP–S/DEV/VG0/LV01

To delete a snapshot:

# Lvremove/dev/vg0/lv01_snap

Third, the power-on graphics or text interface

To view the power-on graphics or text:

# Systemctl Get-default

To set the start-Up graphical interface:

# Systemctl Set-default Graphical.target

Or

# Ln–s/usr/systemd/system/graphical.target/etc/system/system/default.target

To set the boot text interface:

# Systemctl Set-default Multi-user.target

Or

# Ln–s/usr/systemd/system/multi-user.target/etc/system/system/default.target

Ctrl+alt+f2....f6 Text Mode

Ctrl+alt+f1\f7 Graphics Mode

Iv. accidental deletion of grub2 directory solutions:

# GRUB2-INSTALL/DEV/SDA

# Grub2-mkconfig >/boot/grub2/grub.cfg

Five, crack root password step:

Method One:

start-up is transferred to Item 2, the letter e in, there will be root=uuid ... Ro of the line,ro back all deleted, add rd.break(only the line portion), and then press ctrl+x

# Mount–o remount,rw/sysroot/

# chroot/sysroot/

# passwd

Enter a new password

# Touch/.autorelabel

# exit

# exit

Method Two:

start-up is transferred to Item 2, the letter e in, there will be root=uuid ... Ro of the line, the last rhgbquiet to Init=/bin/bash, and then press ctrl+x

# Mount–o REMOUNT,RW/

# passwd

Enter a new password

# Touch/.autorelabel

# Exec/sbin/init

Six,systemctl command:

Start, stop, restart, view status:

# Systemctl Start\stop\restart\status httpd

Activation Service:

# Systemctl Is-active httpd

boot httpd:

# Systemctl Enable httpd

Boot does not start httpd:

# systemctl Disable httpd

use the Systemctl command to kill the service:

# Systemctl Kill httpd

List all services (including enable and disable):

# Systemctl List-units--type=service

To block a service (so that it cannot be started or displayed):

# Systemctl Mask httpd

Unblock:

# Systemctl unmask httpd

This article is from the "Linux" blog, so be sure to keep this source http://yangzhiming.blog.51cto.com/4849999/1718494

RHCE (REDHAT7) (iii)

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.