First we need to understand why with LVM
Generally expand partition:Need to be adjacent。
advantage:LVM makes it easier to manage disk space。If the file system needs more space,Available space volume groups which may be assigned to a logical volume,And you can adjust the size of the file system。If a disk error began to appear,You may be replaced by a disk volume group registered as physical volumes,And the logical volume range can be migrated to a new disk。
In a nutshell:LVM biggest benefit is,Increased easily reduce the partition。But we can not guarantee the security of data。
Lvm most significant feature is that between the file system and the hardware (physical disk) to add a level,A retractable partition。
one、LVM Components
Physical Disk:A partition、Full Disk 、RAID、SAN;The effect of physical volume is;
Physical Volume:physical volume(PV)。LVM The base used "physical" memory。This is usuallyIt is a block device,For example, a partition、Full Disk 、RAID、SAN;These are just ordinary physical partitionPartition,It must be initialized LVM Physical Volume,Can truly LVM use;
Volume Group:volume group(VG)。By one or more physical volumes of。Storage Pool。Default matterProcessing block is 4M。Specifies the physical block physical extent(ON)。on ON,To be investigated man vgcreate;
Logical Volume:logical volume(LV)。The last logical block group。Like the ordinary partition,You can format,Use the mount。It is a partition。But are free to expand the narrowing。
To show their relationship through a map
Ext3 —-> LV ——–> VG ——-> PV ——->Physical Disk
———————————————
two、Common management tools
Here are some common management tools:
1 2 3 |
[root@desktop21 ~]# yum -y install system-config-lvm //安装图形管理包 [root@localhost ~]# system-config-lvm //打开图形界面管理lvm设置 |
The graphical management interface is very simple to save time to do this is not explained in detail
View version lvm
1 2 3 4 5 6 7 |
[root@localhost 桌面]# rpm -qa | grep lvm</span> lvm2-2.02.98-9.el6.x86_64 system-config-lvm-1.1.12-15.el6.noarch lvm2-libs-2.02.98-9.el6.x86_64 |
—
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
[root@localhost桌面]# df -Th 文件系统 类型 容量 已用 可用 已用%% 挂载点 /dev/sda2 ext4 24G 3.2G 20G 14% / tmpfs tmpfs 935M 76K 935M 1% /dev/shm /dev/sda1 ext4 194M 33M 152M 18% /boot [root@localhost 桌面]# fdisk -l /dev/sda Disk /dev/sda: 64.4 GB, 64424509440 bytes 255 heads, 63 sectors/track, 7832 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00043393 Device Boot Start End Blocks Id System /dev/sda1 * 1 26 204800 83 Linux Partition 1 does not end on cylinder boundary. /dev/sda2 26 3188 25395200 83 Linux /dev/sda3 3188 3443 2048000 82 Linux swap / Solaris /dev/sda4 3443 7267 30723153+ 5 Extended /dev/sda5 3443 3507 520922 83 Linux /dev/sda6 3508 3572 522081 83 Linux /dev/sda7 3573 3637 522081 83 Linux /dev/sda8 3638 3702 522081 83 Linux |
First, by fdiskPartitioning,Here I separation of the four partitions aresda5,sda6,sda7,sda8The four partitions,Below we will complete the partitions of a physical disk to be initialized topvThat isLVM The base used "physical" memory
The partition is initialized to the physical volume group pv
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
[root@localhost 桌面]# partx -a /dev/sda 刷新分区表 [root@localhost 桌面]# pvcreate /dev/sda5 /dev/sda6 /dev/sda7 /dev/sda8 Physical volume "/dev/sda5" successfully created Physical volume "/dev/sda6" successfully created Physical volume "/dev/sda7" successfully created Physical volume "/dev/sda8" successfully created 将这几个分区pv初始化完成后我们进行vg(存储池)的创建 将/dev/sda5 /dev/sda6加入到vg00当中 [root@localhost 桌面]# vgcreate vg00 /dev/sda5 /dev/sda6 Volume group "vg00" successfully created [root@localhost桌面]# vgdisplay --- Volume group --- VG Name vg00 System ID Format lvm2 Metadata Areas 2 Metadata Sequence No 1 VG Access read/write VG Status resizable MAX LV 0 Cur LV 0 Open LV 0 Max PV 0 Cur PV 2 Act PV 2 VG Size 1012.00 MiB PE Size 4.00 MiB(默认的lvm的块默认大小为4m) Total PE 253 Alloc PE / Size 0 / 0 Free PE / Size 253 / 1012.00 MiB VG UUID nzadCE-siUI-gX4R-6C9U-q2rL-SOER-9rDP3M 最后进行LV的创建 [root@localhost 桌面]# lvcreate -L 800M -n LV01 vg00 Logical volume "LV01" created 创建lv 制定大小为800M 以LV01命名 在vg00这个存储池中 |
Original article written by LogStudio:R0uter's Blog » Linux storage of lvm (Logical Volume Manager) Logical Volume Manager (1)
Reproduced Please keep the source and description link:https://www.logcg.com/archives/464.html