1、安装lvm
yum -y install lvm2
安装的时候遇到报错:
由提示可知,是由于device-mapper的版本问题导致。于是更新device-mapper-libs:
yum install -y device-mapper-*
再次执行安装命令:
yum -y install lvm2
此时可以成功安装。
2、创建和管理lvm
1)创建一个lvm分区
fdisk /dev/sda
由上图,保存分区的时候有一个报错:
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
意思是内核还用的旧的分区表信息,新的分区表会在重启或者执行partprobe或者kpartx之后使用。
然后我运行了一下partprobe命令,无任何提示。再去看内核分区表:
cat /proc/partitions,
看到分区已经成功加载进去
备注:
lvm的分区编号是8e
2)创建PV