2.LVM Dynamic Logical Volumes

Source: Internet
Author: User

LVM Dynamic Logical volumes

A. Basic Concepts

LVM The actual physical disk data is mapped to a simple and flexible virtual logical storage view, in order to control the disk resources;

That is, the method of managing file systems and volumes is reconsidered, and an additional abstraction layer is added to the file system management, which can implement virtual partitions or dynamically establish a logical volume and change the size of the volume, allowing the file system to span functions such as disk.

physical volume ( PV Physicalvolume

hard disk partitioning or devices that logically share the same functionality as hard disk partitions (such as RAID LVM Span style= "' Font-size:9.0pt;font-family: Song body; Color:black '" "Basic storage logic block,

Unlike basic physical storage media (such as partitions, disks, etc.), it contains LVM management parameters.

VG Spanstyle= ' font-size:9.0pt;font-family: Song body; Color:black '): Volumegroup

LVM The highest level of abstraction in a layer, consisting of one or more physical volumes. You can create one or more logical volumes on a volume group.

Logical Volumes ( LV ): Logicalvolume

Logical Volumes ( LV ) is established on the volume group, which is equivalent to non- LVM a partition in the system on which you can create a file system, such as /Homeor/ var and so on.

Physical Blocks ( PE ): physicalextent

each physical volume is divided into equal size called PE ( physicalextents ) is a basic unit with a unique number PE is can be LVM the smallest unit of addressing. PE the size is configurable, and the default is 4MB .

First, scan to see if there is LVM , as shown in the figure below, without LVM

So, let's do it next. LVM Dynamic Logical Volume experiment

A. Creating LVM dynamic Logical volumes

First Add 4 block partition and convert to LVM to Create a physical volume

Write it to the kernel

the partition /dev/sda5,/dev/sda6,/dev/sda7 created as a physical volume so that LVM can recognize

and then scan it and find out there 3 Logical Volume /dev/sda5/dev/sda6/dev/sda7 , which means the creation was successful.

viewing logical Volume Information

Next, create a logical volume group vg01 , the size of the PE is 8M , and the physical volume /dev/sda5 and / Dev/sda6 added to Logical volume group vg01

Viewing logical Volume Group information

immediately after the logical volume group Create Logical Volume LVM under vg01 with a size of 800M

viewing logical Volume Information

then format the logical volume /DEV/VG01/LVM, format it as a ext3 file system

Next in / create a file with LVM and mount the logical volume to /LVMby command MOUNT/DEV/VG01/LVM/LVM c15> under

then add it to the /etc/fstab in order to restart the system and still take effect

Make the Mount effective

View mount information and discover LVM mount success!!!

Two Online Expansion LVM Dynamic Logical Volumes

To meet your needs, here you want to extend the logical volume to 1300M , then the previous 2 physical volumes, that is 1000M of storage space is certainly not enough, so you need to add a piece of physical volume /DEV/SDA7 to Logical Volume group vg01

View Logical volume groups again vg01 information, found nearly 1500M of storage space, enough to meet The storage needs of 1200M

Logical Volume group extended to 1500M , then the logical volume can be expanded accordingly, so the logical volume vg01 is extended to 1300M

View the information for a logical volume and discover vg01 's almost 1300M .

It is then known that although the logical volume has been expanded, it has not changed on the file system mount, and then the command RESIZE2FS/DEV/VG01/LVM stretch the extended logical volume onto the file system, then view it.

Three reduce logical volumes offline

If the storage space is found to be too large in the production ring lens, the storage space needs to be reduced to reduce waste.

1. First, you need to unload the logical volume vg01

The command is UMOUNT/LVM and can be found to have been uninstalled.

2. Scan Logical Volume LVM

3. First, reduce the file system to 300M

then reduce the logical volume to 300M

the logical volume is then LVM mount to/LVM again , by the know, has successfully changed the size of the file system

then look at the logical volume again LVM , without a doubt, is reduced to 300M

Four Removing a logical Volume group vg01

This requires a gradual removal, first removing the logical volume LVM , found unable to remove

you need to uninstall it before removing it, first remove the logical volume LVM , and then remove the logical volume vg01 .

so far LVM The basic experiment is over!!!



From for notes (Wiz)

List of attachments

    2.LVM Dynamic Logical Volumes

    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.