Under CentOS7 LVM create an administrative

First understand a few concepts:

  • PV (physical volume): the lowest physical volume in the logical volume management system, for the entire physical hard disk or actual physical hard disks.
    Command: pvdisplay
  • VG (volume group): the volume group based on the physical volume, the volume comprising at least a group of physical volumes, the volume groups may be established dynamically add volume to the volume group, a logical volume management system may have a plurality of Project volume group.
    Command: vgdisplay
  • LV (logical volume): establish the logical volume group on the basis of the unallocated space in the volume group can be used to create a new logical volume, can reduce the space and the dynamic extension after establishing the logical volume.
    Command: lvdisplay
  • PE (physical extent): the physical area is the smallest storage unit physical volume available for allocation, the physical size of the area specified in the establishment of the volume group, once determined can not be changed, the same volume group physical area for all physical volumes the same size needs, new was added to vg after pv, pe pe to automatically change the size of defined size vg.
  • LE (logical extent): logical area is the smallest logical memory unit that can be used to dispense, the size of the logical region depends on the size of the physical area of ​​the logical volume in the volume group.
  • Description region volume group: volume group exists in each area is described in the physical volume, physical volume is used to describe all of the information itself, the physical volume belongs to the volume group, logical volumes in the volume group, logical volume allocation physical area, it is established when using pvcreate establish physical volume.

Example:
a Centos7 add a virtual machine disk, this disk LVM management.

  1. Look at the newly added disk status
    inquiry and control commands
    lsblk

    Under CentOS7 LVM create an administrative
    You can find a 400G of disk sdb.

  2. PV create physical machine
    command
    pvcreate /dev/sdb
    pvs

    Under CentOS7 LVM create an administrative

  3. Creating VG volume group
    command
    vgcreate -s 16M  VG-1 /dev/sdb
    vgs

    Wherein -s parameter specifies the size of the PE, generally 4M, 8M, 16M. VG-1 volume group name.
    Under CentOS7 LVM create an administrative

  4. Create a logical volume LV
    command
    lvcreate -L 300G -n LV-1 VG-1 
    lvs

    Wherein -L parameter specifies the size of the logical volume LV, -n specified logical volume name, followed by the name of the volume group.
    Under CentOS7 LVM create an administrative

  5. Create the specified logical volume and mount the file system
    to create a file system commands, xfs specified format Centos7.
    mkfs -t xfs /dev/VG-1/LV-1
    mount /dev/VG-1/LV-1 /data/

    Under CentOS7 LVM create an administrative

  6. Fstab file written
    inquiry and control logical UUID, the information is written to / etc / fatab file, and boot, shutdown from the start.
    Inquiry and control commands
    blkid

    Under CentOS7 LVM create an administrative
    vim /etc/fstab
    Under CentOS7 LVM create an administrative

  7. Extended logical
    premise VG volume group to ensure that there is space to extend the logical volume into the remaining space.
    Command, add the -r parameter expansion with logical volumes and file systems. -L + 10G, 10G size increases.
    vgs
    lvextend -r -L +10G /dev/VG-1/LV-1
    lvs

    Under CentOS7 LVM create an administrative
    The original 300G 310G increase the.

Guess you like

Origin blog.51cto.com/10874766/2475490