LVM is a mechanism for dynamically adjusting the way Linux partitions are partitioned. Logical volumes can be read and write efficiently without the high average disk, but the dynamic management of disk space is a more flexible way to manage the device. The underlying logical volume can be a disk, a RAID array, or a SAN disk.
The process of creating a logical volume can be summed up in the following four sections: Hardware Device-> Create a physical volume PV-> Create a volume group
traditional disk management mechanism, our upper-layer applications directly access the file system to read the underlying physical hard disk. In LVM, it encapsulates the underlying hard disk. When we operate the underlying physical hard disk, it is no longer for partitioning, instead, you can manage the underlying disk of a logical volume. For example, if I add a physical hard disk, the upper-layer service will not feel it at this time, because the last service is presented in a logical volume
Create and manage LVM:
Create a partition
Disk/dev/xvdc: 2147 MB, 2147483648 bytes255 heads, 63 sectors/track, 261 cylindersunits = cylinders of 16065*512 = 8225280 bytessector size (logical/physical ): 512 bytes/512 bytesi/o size (minimum/optimal): 512 bytes/512 bytesdisk identifier: 0xd199e24a device boot start end blocks ID system/dev/xvdc1 1 65 522081 8e Linux LVM # adjust the partition type to Linux LVM/dev/xvdc2 66 104 313267 + 8e Linux LVM/dev/xvdc3 105 181 618502 + 8e Linux LVM
Create
The previous article introduced some concepts of LVM. This article will teach you some daily LVM operations. After all, the theory must be applied in practice.
This blog article is divided into eight points to describe and operate LVM functions, hoping to help you.
1. Create a new volume
1. Prepare the Physical partition Physical Partions)
Use a partition tool such as fdisk to create an LVM partition in the same way as creating other common partitions. The difference is that the LVM partition
about the enterprise data information is changing all the day, the future of the enterprise's disk there is no extra space can be used to store data, there is no way to achieve the enterprise disk space in the case of downtime to expand it, with the advent of LVM these problems we can solve.
Three: The LVM layers are introduced. PV(physical VOLUME,PV): Physical volume, physical disk partition but its file format is not ext4 these, Instead, the LVM format with LVM management is in 8e form
To move a disk space in linux to/home: 1. view disk space [root @ compute home] # df-hFilesystem Size Used Avail Use % Mounted on/dev/mapper/vg_compute-lv_root 531G 48G 478G 10%/tmpfs 16G 88 K 16G 1%/dev/shm/dev/mapper/ddf3164c5349202020202010000055000000004711471100001450p1 485 M 38 M 422 M 9%/boot 2. uninstall/homeumount/home/3. view logical volume group information [root @ compute home] # vgs VG # PV # LV # SN Attr VSize VFree vg_compute 1 3 0 wz -
To move a disk space in linux to/home: 1. view disk space [root @ computehome] # df-hFilesystemSizeUsedAvailUse % Mountedon/dev/mapper/vg_compute-lv_root... to move a disk space in linux to/home: 1. view disk space [root @ compute home] # df-hFilesystem Size Used Avail Use % Mounted on/dev/mapper/vg_compute-lv_root 531G 48G 478G 10%/tmpfs 16G 88 K 16G 1%/dev/shm/dev/mapper/ddf3164c5349202020202010000055000000004711471100001450p1 485 M 38 M 422 M 9%/boot 2. uninstall/homeumount/home/3. view logic
use a symbolic link or a tool to adjust the partition size (such as patitionmagic), but this is only a temporary solution, the problem is not fundamentally solved. With the appearance of the Logical Disk volume management function in Linux, these problems have been solved, and users can easily adjust the size of each partition without downtime.
Demo environment: centos6.4. Three hard disks, two of which are created and one is extended.
Overview: PE | PV | V
LVM. The most common hard-to-decide problem that Linux users encounter when installing the Linux operating system is how to correctly evaluate the size of each partition to allocate suitable hard disk space. When a partition space is exhausted, the solution is usually to use a symbolic link or a tool to adjust the partition size (such as PatitionMagic), but this is only a temporary solution, the problem is not fundamentally solved. With the appearance of the logical disk volume management funct
LVM
The full name of LVM is logical volume manager. The reason for becoming a volume is that it can stretch or shorten the file system like a volume. LVM combines several physical partitions or disks into a large independent disk (VG) through software, and then partitions the disk, it is divided into usable partitions (LV) and can be mounted and used.
PV physical volume
We need to adjust the system identifier (System ID) to 8E (LVM identifier) for ou
lvm:logical Volume Manager, logical Volume Manager. It is a mechanism for disk partition management in the LIUNX environment. Shields the underlying disk layout and facilitates dynamic disk capacity adjustment. It can also be created on raid, adding redundancy. However,/boot is used to store the bootstrap file and cannot be applied LVM. Its working mechanism is to combine the underlying physical volumes (PV, which can be multiple disks or multiple physical partitions) into a single volume group
Installing the HA SoftwareFirst, install the softwareThe most stable version is 5.4.0, priority installation stable version 5.4Install depends on package base.data, cluster man pack installation failure reason is missing Base.data packageInstall all cluster. Packages that begin with, you can not install the Cluster.man packageSecond, hit the HA patchExecute the instructions before patching: Inutoc generate the. toc file, and then Smitty Update_all upgrade Cluster to 5.4.1.0 versionConsiderations
LVM: Logical volumn manager logical volume Management
What is used?
LVM converts a storage device into a PV, organizes one or more PVS into one or more volume groups, and then creates a LV on the volume group. After creating the LV and formatting it, you can mount and use it. The benefits of using LVM to manage hard disks are that you can adjust the partition size without shutting down and expand the disk easily. A single partition can be located on multiple hard disks. The size of each partit
logical volume of the way. The most important feature of LVM is the ability to dynamically manage disks. Because the size of the logical volume can be dynamically adjusted, and no existing data is lost. If we add a new hard disk, it will not change the existing upper-level logical volumes. As a dynamic disk management mechanism, logical volume technology greatly improves the flexibility of disk Management. Basic Logical Volume Management concepts: PV (physical Volume)-Physical volumeThe physica
partition (1-4) p Partition number (1-4): 1 First cylinder (1-63, default 1 ): using default value 1 Last cylinder or + size or + sizeM or + sizeK (1-63, default 63): Using default value 63 Command (m for help ): w The partition table has been altered! Calling ioctl () to re-read partition table. Syncing disks. [root @ o564gtser1 ~] # Pvcreate/dev/sdd1 Physical volume "/dev/sdd1" successfully created [root @ o564gtser1 ~] # Pvs pv vg Fmt Attr PSize P
LVM: logicalvolumemanager (logical volume management). LVM shields the underlying disk layout and facilitates dynamic adjustment of disk capacity. 1. steps for creating a logical volume: 1) use the fdisk tool to convert the disk to a linux partition 2) use the pvcreate command to convert the linux partition to a physical volume (PV); 3) use the vgcreate command to process the created physical volume
LVM: logical volumemanager (logical volume management); LVM shields the underlying disk layout an
Mount another hard disk in centos
Try to mount another hard disk in centos. One of the partitions is in LVM2 format and cannot be mounted directly. The method is recorded as follows for future use.
1. First, use vgscan to scan lvm. The result is as follows:
[Root @ localhost ~] # VgscanReading all physical volumes. This may take a while...WARNING: Duplicate VG name VolGroup00: Existing bgKw70-NEBI-QY6s-RvqU-3a59-N8E1-ruOWwh (created here) takes preced
size of the original file system, we only need to adjust the/home size to use a larger partition, and then we can return to the business.
Of course, lvm can also take snapshots of itself, which enables us to back up some unmovable targets.
Second, basic components of LVM
Physical Media ----- The Physical Media, which indicates that it is only a hard disk or a partition, such as/dev/hda,/dev/sda,/dev/sda4, and so on.
Physical Volume ----- Physical Volume (PV) a pv is only a Physical medium wit
without losing existing data. If we add a new hard disk, it will not change the existing upper-layer logical volume. As a dynamic disk management mechanism, logical volume technology greatly improves the flexibility of disk management.
Basic logical volume management concepts:
PV (Physical Volume)-Physical VolumeThe physical volume is at the bottom of the logical volume management. It can be an actual physical hard disk.Partition, or the wholeThe physical hard disk can also beRaid device.
, and its physical volume (PV) are used ). One or more physical volumes can be used to create a volume Group (VG ). Then, you can create logical volumes (LV) based on the volume group ). As long as there is space available in the volume group, you can create logical volumes as you like. The file system is created on a logical volume and can be mounted and accessed in the operating system.
LVM test description
This article describes how to create and m
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.