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 understand LVM in Linux

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article introduces how to understand LVM in Linux. The content is very detailed. Interested friends can use it for reference. I hope it will be helpful to you.

I. concept

PV (physical volume,PV): physical volume, whose file format is not ext4, but LVM with LVM management function

VG (Volume Group,VG): volume groups, volume groups are created on the basis of PV physical volumes, volume groups are made up of one or more physical volumes, and volume groups can be expanded and shrunk on the basis of physical volume PV.

LV (logical volume,LV): logical volumes, created on the basis of VG, can be formatted, file systems can be created, and can be mounted. For users, it is equivalent to a disk partition, but it is actually logical on VG. It can be expanded and narrowed on the basis of VG, and the boundary of expansion cannot exceed VG.

PE (Physical Extents): PE is equivalent to block blocks, and the default is 4m. A physical volume PV is divided into basic units called PE (Physical Extents). VG is made up of these PE blocks, which is the key reason why VG is free to expand and shrink.

II. Installation

Yum-y install lvm2

III. List of commands

Pv physical Volume

Create physical volume: pvcreate disk partition name

Pvcreate / dev/sdb1 / dev/sdb1

Delete physical volumes: pvremove pv_name

Scan the pv in the system

Pvscan

Display the details of a physical volume

Pvdisplay [pv_name]

Vg volume group

Create vg

Vgcreate vg_name pv1_name pv2_name

Vgcreate-s size:-s: specifies the PE size, and the number must be to the integer power of 2

Delete vg

Vgremove vg_name

Scan all vg in the system

Vgscan

Show a volume group details

Vgdisplay [vg_name]

Expand volume group capacity

Vgextend vg_name pv1_name

Lv logical Volume

Create a logical volume

Logical volumes: block device files / dev/ volume groups / logical volumes

Lvcreate-L capacity-n name volume group name

Number of lvcreate-l PE-n name volume group name

PE:Physical Extent physical expansion Unit

Default PE size: 4m

Lvcreate-s-L capacity-n snapshot name logical volume name

-s:snapshot snapshot

Delete logical Volum

Lvremove lv_block_name

Scan all logical volumes in the system

Lvscan

View the details of a logical volume

Lvdisplay [lv_block_name]

Expand logical volume capacity

Lvextend-L + 3G / dev/data/webdata on how to understand LVM in Linux is shared here. I hope the above content can be helpful to everyone and learn more knowledge. If you think the article is good, you can share it for more people to see.

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