Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to create a management LVM in a CentOS system?

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Let's start with a few concepts:

PV (physical volume): physical volumes are at the bottom of the logical volume management system and can be partitioned to the entire physical hard disk or the actual physical hard disk.

Command: pvdisplayVG (volume group): the volume group is established on the physical volume, and at least one physical volume must be included in the volume group. After the volume group is established, the volume group can be dynamically added to the volume group. There can be multiple volume groups in a logical volume management system project.

Command: vgdisplayLV (logical volume): logical volumes are based on volume groups. Unallocated space in volume groups can be used to create new logical volumes. After logical volumes are established, the space can be dynamically expanded and reduced.

Command: lvdisplayPE (physical extent): the physical area is the smallest storage unit available for allocation in the physical volume. The physical area size is specified when the volume group is established. Once it is determined that the physical area size of all physical volumes in the same volume group cannot be changed, the physical area size of all physical volumes in the same volume group should be the same. After the new pv is added to the vg, the size of the pe is automatically changed to the pe size defined in the vg. LE (logical extent): a logical region is the smallest storage unit in a logical volume that can be allocated, and the size of the logical area depends on the size of the physical area in the volume group in which the logical volume resides. Volume group description area: the volume group description area exists in each physical volume and is used to describe all the information such as the physical volume itself, the volume group to which the physical volume belongs, the logical volume in the volume group, the allocation of physical areas in the logical volume, and so on. It is established when the physical volume is established using pvcreate.

Example:

A Centos7 virtual machine adds a disk, which is managed by LVM.

Take a look at the status of the newly added disk first.

Search and control command lsblk

The SDB-400G disk can be found.

Create a PV physical machine

Command pvcreate / dev/sdbpvs

Create a VG volume group

Command vgcreate-s 16m VG-1 / dev/sdbvgs

The parameter-s specifies the PE size, generally 4m, 8m, 16m. VG-1 volume group name.

Create a LV logical volume

Command lvcreate-L 300G-n LV-1 VG-1 lvs

The parameter-L specifies the logical volume LV size, and-n specifies the logical volume name, followed by the volume group name.

Logical volume creation specified file system and mount

Create a file system command, and specify the xfs format under Centos7. Mkfs-t xfs / dev/VG-1/LV-1mount / dev/VG-1/LV-1 / data/

Write to fstab file

Check and control the logic volume UUID, write the information into the / etc/fatab file, and realize the self-startup of boot and shutdown.

Search and control command blkid

Vim / etc/fstab

Extended logical Volume

The premise is to ensure that the VG volume group has space and extend the remaining space into the logical volume.

Command, add the parameter-r to expand the logical volume and the file system together. -L + 10G, increase the size of 10G. Vgslvextend-r-L + 10G / dev/VG-1/LV-1lvs

The original 300g has been increased to 310g.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report