Calling ioctl() to re-read partition table.
Syncing disks.
[root@test-centos7-node1 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 50G 0 disk
├─sda1 8:1 0 2G 0 part /boot
├─sda2 8:2 0 2G 0 part [SWAP]
└─sda3 8:3 0 46G 0 part /
sdb 8:16 0 50G 0 disk
├─sdb1 8:17 0 10G 0 part
├─sdb2 8:18 0 10G 0 part
└─sdb3 8:19 0 10G 0 part
sr0 11:0 1 792M 0 rom
[root@test-centos7-node1 ~]#
说明:这里是用的分区来模拟硬盘当作PV,这里需要注意一点,就是我们分区完保存后,可能存在不同不到问题,就是我们分区完
用lsblk看不到分区,可用 partprobe来同步分区信息。centos6 使用partx -a /dev/sdb来增加分区同步到内存,如果是删除某个分区,
就需要执行partx -d -nr # /dev/sdb 此命令表示从/dev/sdb的分区信息中删除sdb#分区信息,并同步到内存中。这里还需要注意一点的
是我们分区的类型要选8e 表示Linux LVM
2)装lvm2这个包
[root@test-centos7-node1 ~]# lvs
-bash: lvs: command not found
[root@test-centos7-node1 ~]# yum info lvm2
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
Available Packages
Name : lvm2
Arch : x86_64
Epoch : 7
Version : 2.02.185
Release : 2.el7_7.2
Size : 1.3 M
Repo : updates/7/x86_64
Summary : Userland logical volume management tools
URL : http://sources.redhat.com/lvm2
License : GPLv2
Description : LVM2 includes all of the support for handling read/write operations on
: physical volumes (hard disks, RAID-Systems, magneto optical, etc.,
: multiple devices (MD), see mdadm(8) or even loop devices, see
: losetup(8)), creating volume groups (kind of virtual disks) from one
: or more physical volumes and creating one or more logical volumes
: (kind of logical partitions) in volume groups.
[root@test-centos7-node1 ~]# yum install lvm2 -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
---> Package lvm2.x86_64 7:2.02.185-2.el7_7.2 will be installed
--> Processing Dependency: lvm2-libs = 7:2.02.185-2.el7_7.2 for package: 7:lvm2-2.02.185-2.el7_7.2.x86_64
--> Processing Dependency: device-mapper-persistent-data >= 0.7.0-0.1.rc6 for package: 7:lvm2-2.02.185-2.el7_7.2.x86_64
--> Processing Dependency: liblvm2app.so.2.2(Base)(64bit) for package: 7:lvm2-2.02.185-2.el7_7.2.x86_64
--> Processing Dependency: libdevmapper.so.1.02(DM_1_02_141)(64bit) for package: 7:lvm2-2.02.185-2.el7_7.2.x86_64
--> Processing Dependency: libdevmapper-event.so.1.02(Base)(64bit) for package: 7:lvm2-2.02.185-2.el7_7.2.x86_64
--> Processing Dependency: liblvm2app.so.2.2()(64bit) for package: 7:lvm2-2.02.185-2.el7_7.2.x86_64
--> Processing Dependency: libdevmapper-event.so.1.02()(64bit) for package: 7:lvm2-2.02.185-2.el7_7.2.x86_64
--> Running transaction check
---> Package device-mapper-event-libs.x86_64 7:1.02.158-2.el7_7.2 will be installed
---> Package device-mapper-libs.x86_64 7:1.02.140-8.el7 will be updated
--> Processing Dependency: device-mapper-libs = 7:1.02.140-8.el7 for package: 7:device-mapper-1.02.140-8.el7.x86_64
---> Package device-mapper-libs.x86_64 7:1.02.158-2.el7_7.2 will be an update
---> Package device-mapper-persistent-data.x86_64 0:0.8.5-1.el7 will be installed
---> Package lvm2-libs.x86_64 7:2.02.185-2.el7_7.2 will be installed
--> Processing Dependency: device-mapper-event = 7:1.02.158-2.el7_7.2 for package: 7:lvm2-libs-2.02.185-2.el7_7.2.x86_64
--> Running transaction check
---> Package device-mapper.x86_64 7:1.02.140-8.el7 will be updated
---> Package device-mapper.x86_64 7:1.02.158-2.el7_7.2 will be an update
---> Package device-mapper-event.x86_64 7:1.02.158-2.el7_7.2 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
============================================================================================================================
Package Arch Version Repository Size
============================================================================================================================
Installing:
lvm2 x86_64 7:2.02.185-2.el7_7.2 updates 1.3 M