Linux System Management-(5)-LVM

Source: Internet
Author: User

What is LVM?

LVM is a shorthand for Logical Volume Manager (Logical Volume management), which is a mechanism for managing disk partitions in a Linux environment, allowing users to easily adjust the size of each partition without having to stop.

Why use LVM?

The perfect solution is to be able to adjust the size of the file system at 0 downtime, allowing the file system to span different disks and partitions

LVM-Related basics:

* Physical storage media (Physicalstoragemedia)

Refers to the system's physical storage device: disk, such as:/dev/hda,/DEV/SDA, etc., is the storage system at the bottom of the storage unit.


* Physical Volume (physical VOLUME,PV)

A disk partition or device that logically has the same functionality as a disk partition (such as RAID), is the basic storage logic block of LVM, but is compared to basic physical storage media (such as partitions, disks, etc.) and contains management parameters related to LVM.


* Volume group (Volume GROUP,VG)

Similar to a physical disk in a non-LVM system, which consists of one or more physical volumes of PV. You can create one or more LV (logical volumes) on a volume group.


* Logical Volume (Logical volume,lv)

Similar to a disk partition in a non-LVM system, the logical volume is built on the volume group VG. File systems (such as/home or/usr, etc.) can be created on top of the logical volume LV.


* Physical block (physical extent,pe)

Each physical volume PV is divided into a basic unit called the PE (physical extents), with a uniquely numbered PE being the smallest unit that can be addressed by LVM. The size of the PE is configurable and defaults to 4MB. So the physical volume (PV) is made up of basic unit PE of equal size.


* Logic block (Logical Extent,le)

The logical volume LV is also divided into a basic unit that can be addressed, called Le. In the same volume group, the size of Le is the same as the PE, and one by one corresponds.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/72/68/wKiom1Xi62OB5a8GAADgFvA_IXk554.jpg "title=" Lvm.png "alt=" Wkiom1xi62ob5a8gaadgfva_ixk554.jpg "/>

To create an LVM partition:


PV Management tools:
PVS: Brief PV information display

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/72/64/wKioL1Xi8pWSoaT-AACCa7Y8Lj4067.jpg "title=" Pvs.png "alt=" Wkiol1xi8pwsoat-aacca7y8lj4067.jpg "/>

Pvdisplay: Show Details of PV

Create PV

Pvcreate/dev/device:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/72/68/wKiom1Xi7j6gKEeIAABGYQGxzQ8252.jpg "title=" pv.png "alt=" Wkiom1xi7j6gkeeiaabgyqgxzq8252.jpg "/>


VG Management tools:
VGS: Brief display of VG information
Vgdisplay: Show VG Details
Create VG
vgcreate [-S #[kkmmggttppee]] custom VG name PV address

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/72/65/wKioL1Xi9DyxY4fVAABJJtg9s-w729.jpg "title=" Vgreat.png "alt=" Wkiol1xi9dyxy4fvaabjjtg9s-w729.jpg "/>

Extended VG

Vgextend VG Name PV address [Physicaldevicepath ...]

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/72/65/wKioL1Xi9p3jC9g3AABDiIMRIXM060.jpg "title=" Vge.png "alt=" Wkiol1xi9p3jc9g3aabdiimrixm060.jpg "/>

Reduce VG

Vgreduce VG Name PV name [Physicaldevicepath ...]
Do Pvmove first.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/72/65/wKioL1Xi9h6BGjpLAABX9hhFmxg402.jpg "title=" Vgr.png "alt=" Wkiol1xi9h6bgjplaabx9hhfmxg402.jpg "/>

Delete VG vgremove


LV Management tools:
LVS briefly displays LV information
Lvdisplay Show LV Details
Create LV:
Lvcreate-l #[mmggtt]-n NAME volumegroup
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/72/68/wKiom1Xi9azwcZB4AABmMlWuQ1A211.jpg "title=" Lvc.png "alt=" Wkiom1xi9azwczb4aabmmlwuq1a211.jpg "/>

Lvremove/dev/vg_name/lv_name

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/72/65/wKioL1Xi-D7SsSN0AAB867HHjz0032.jpg "title=" Lvremove.png "alt=" Wkiol1xi-d7sssn0aab867hhjz0032.jpg "/>

Extend the logical volume: Extend the LV extension file system first
# lvextend-l [+]#[MMGGTT]/dev/vg_name/lv_name
# Resize2fs/dev/vg_name/lv_name

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/72/65/wKioL1Xi-qvSNFsOAACVwhdZRWw923.jpg "title=" Lvextand.png "alt=" Wkiol1xi-qvsnfsoaacvwhdzrww923.jpg "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/72/65/wKioL1Xi-zeimxCpAABq8IpxBtY959.jpg "title=" Ree2.png "alt=" Wkiol1xi-zeimxcpaabq8ipxbty959.jpg "/>

Reduce logical volumes: Reduce the file system and then reduce the LV
# Umount/dev/vg_name/lv_name
# e2fsck-f/dev/vg_name/lv_name
# Resize2fs/dev/vg_name/lv_name #[mmggtt]
# lvreduce-l [-]#[MMGGTT]/dev/vg_name/lv_name
# mount

Linux System Management-(5)-LVM

Related Article

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.