LVM管理
# lvm工作原理
LVM是在磁盘分区和文件系统之间添加的一个逻辑层,来为文件系统屏蔽下层磁盘分区布局,提供一个抽象的盘卷,在盘卷上建立文件系统。管理员利用LVM可以在磁盘不用重新分区的情况下动态调整文件系统的大小,并且利用LVM管理的文件系统可以跨越磁盘,当服务器添加了新的磁盘后,管理员不必将原有的文件移动到新的磁盘上,而是通过LVM可以直接扩展文件系统跨越磁盘
它就是通过将底层的物理硬盘封装起来,然后以逻辑卷的方式呈现给上层应用。在LVM中,其通过对底层的硬盘进行封装,当我们对底层的物理硬盘进行操作时,其不再是针对于分区进行操作,而是通过一个叫做逻辑卷的东西来对其进行底层的磁盘管理操作。
逻辑卷管理的核心在于如何处理我们系统中安装的硬盘及其分区,对于我们的逻辑卷管理器来说,把硬盘当作物理卷来看
# LVM常用的术语
先来了解一下常用的名词解释
- 物理存储介质(The physical media)
这里指系统的存储设备文件,可是磁盘分区,整个磁盘,RAID阵列或SAN磁盘,设备必须初始化为LVM物理卷,才能与LVM结合使用
- 物理卷PV(physical volume)
物理卷就是指硬盘分区或从逻辑上与磁盘分区具有同样功能的设备(如RAID),是LVM的基本存储逻辑块,但和基本的物理存储介质(如分区、磁盘等)比较,却包含有与LVM相关的管理参数 (注册物理设备以便在卷组中使用),创建物理卷它可以用硬盘分区,也可以用硬盘本身;
- 卷组VG(Volume Group)
LVM卷组类似于非LVM系统中的物理硬盘,一个LVM卷组由一个或多个物理卷组成
- 逻辑卷LV(logical volume)
类似于非LVM系统中的硬盘分区,LV建立在VG之上,可以在LV之上建立文件系统
- PE(physical extents)
PV中可以分配的最少存储单元,PE的大小是可以指定的,默认为4MB
- LE(logical extent)
LV中可以分配的最少存储单元,在同一个卷组中,LE的大小和PE是相同的,并且一一对应
# LVM优点
- 使用卷组,使多个硬盘空间看起来像是一个大的硬盘
- 使用逻辑卷,可以跨多个硬盘空间的分区 sdb1 sdb2 sdc1 sdd2 sdf
- 在使用逻辑卷时,它可以在空间不足时动态调整它的大小
- 在调整逻辑卷大小时,不需要考虑逻辑卷在硬盘上的位置,不用担心没有可用的连续空间
- 可以在线对LV,VG 进行创建,删除,调整大小等操作。LVM上的文件系统也需要重新调整大小。
- 可以将正在使用中的硬盘迁移到别的硬盘上(emc--500G DELL---1.2T)
- 允许创建快照,可以用来保存文件系统的备份。只能使用一次
解释:
LVM是软件的卷管理方式,而RAID是磁盘保护的方法。对于重要的业务来说,一般是同时存在。RAID用来保护物理的磁盘不会因为故障而中断业务。LVM用来实现对卷的良性的管理,更好的利用磁盘资源
# 创建LVM的基本步骤
先做物理卷 pvcreate /dev/sdb1
把不同的物理卷加入到卷组当中 vgcreate datavg /dev/sdb1
创建逻辑卷 lvcreate
格式化文件系统 mkfs.xfs
- 创建挂载点并进行挂载 mount
lvcreate -l +100%FREE 指定全部大小
对ext类型文件系统扩容: resize2fs
对xfs类型文件系统扩容: xfs_growfs
resize2fs和xfs_growfs 两者的区别是传递的参数不一样的,xfs_growfs是采用的挂载点;resize2fs是逻辑卷名称,而且resize2fs命令不能对xfs类型文件系统使用
# LVM删除
创建: pvcreate ---> vgcreate ---> lvcrdeate ---> mkfs.xfs lv ----> mount
删除: umount ----> lvremove lv -----> vgremove vg -----> pvremove
# 底层存储更换新建PV pvcreate /dev/sdc1
扩容VG vgextend datavg /dev/sdc1
移动数据 pvmove /dev/sdb5 /dev/sdc1
VG缩小 vgreduce datavg /dev/sdb5
删除小盘 pvremove /dev/sdb5
# 扩容操作
1.fdisk /dev/vdc //给新加的硬盘设备/dev/vdc创建分区(注意设备名称略有差异,步骤同下)
2.分别按n、p、1、t、8e、wr
3.pvcreate /dev/vdc1
4.vgextend vg0 /dev/vdd1
5.lvextend -l +100%FREE /dev/vg0/lv0
6. xfs_growfs /dev/vg0/lv0
2
3
4
5
6
# 大于2T的扩容使用
1. 使用parted方式格式化磁盘
1.1 查看磁盘情况
[root@jylhlog2 ~]# fdisk -l
Disk /dev/sdd: 2199.0 GB, 2199023255552 bytes, 4294967296 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sdb: 42.9 GB, 42949672960 bytes, 83886080 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sdc: 2199.0 GB, 2199023255552 bytes, 4294967296 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sde: 2199.0 GB, 2199023255552 bytes, 4294967296 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sdf: 2199.0 GB, 2199023255552 bytes, 4294967296 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sda: 536.9 GB, 536870912000 bytes, 1048576000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0008ce60
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 1048567807 523234304 8e Linux LVM
Disk /dev/mapper/vg_root-lv_root: 64.4 GB, 64424509440 bytes, 125829120 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/vg_root-lv_swap: 68.7 GB, 68719476736 bytes, 134217728 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/vg_root-lv_data: 209.4 GB, 209371267072 bytes, 408928256 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/vg_root-lv_home: 64.4 GB, 64424509440 bytes, 125829120 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/vg_root-oracle: 64.4 GB, 64424509440 bytes, 125829120 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/vg_root-lv_grid: 64.4 GB, 64424509440 bytes, 125829120 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sdg: 2199.0 GB, 2199023255552 bytes, 4294967296 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
[root@jylhlog2 ~]#
1.2 使用parted格式化/dev/sdg分区
[root@jylhlog2 ~]# parted /dev/sdg
GNU Parted 3.1
Using /dev/sdg
Welcome to GNU Parted! Type ‘help’ to view a list of commands.
(parted) mklabel gpt ------将MBR分区形式转为GPT分区形式
(parted) mkpart primary xfs 0 -1 ------设置分区的开始位置和结束位置
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? Ignore
(parted) print ------查看分区
Model: VMware Virtual disk (scsi)
Disk /dev/sdg: 2199GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 17.4kB 2199GB 2199GB primary
(parted) toggle 1 lvm ------使用toggle 更改硬盘类型
(parted) print ------查看分区
Model: VMware Virtual disk (scsi)
Disk /dev/sdg: 2199GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 17.4kB 2199GB 2199GB primary lvm
(parted) quit
Information: You may need to update /etc/fstab.
[root@jylhlog2 ~]#
1.3 查看格式化后的分区情况
[root@jylhlog2 ~]# fdisk -l
Disk /dev/sdd: 2199.0 GB, 2199023255552 bytes, 4294967296 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sdb: 42.9 GB, 42949672960 bytes, 83886080 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sdc: 2199.0 GB, 2199023255552 bytes, 4294967296 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sde: 2199.0 GB, 2199023255552 bytes, 4294967296 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sdf: 2199.0 GB, 2199023255552 bytes, 4294967296 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sda: 536.9 GB, 536870912000 bytes, 1048576000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0008ce60
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 1048567807 523234304 8e Linux LVM
Disk /dev/mapper/vg_root-lv_root: 64.4 GB, 64424509440 bytes, 125829120 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/vg_root-lv_swap: 68.7 GB, 68719476736 bytes, 134217728 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/vg_root-lv_data: 209.4 GB, 209371267072 bytes, 408928256 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/vg_root-lv_home: 64.4 GB, 64424509440 bytes, 125829120 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/vg_root-oracle: 64.4 GB, 64424509440 bytes, 125829120 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/vg_root-lv_grid: 64.4 GB, 64424509440 bytes, 125829120 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
Disk /dev/sdg: 2199.0 GB, 2199023255552 bytes, 4294967296 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: gpt
Disk identifier: 9C5E039C-2C6C-4585-8EAB-7B2DBA949516
# Start End Size Type Name
1 34 4294965343 2T Linux LVM primary
[root@jylhlog2 ~]#
1.4 使系统重读分区表
[root@jylhlog2 ~]# partprobe
Warning: Unable to open /dev/sr0 read-write (Read-only file system). /dev/sr0 has been opened read-only.
[root@jylhlog2 ~]#
[root@jylhlog2 ~]# fdisk -l
Disk /dev/sdd: 2199.0 GB, 2199023255552 bytes, 4294967296 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sdb: 42.9 GB, 42949672960 bytes, 83886080 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sdc: 2199.0 GB, 2199023255552 bytes, 4294967296 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sde: 2199.0 GB, 2199023255552 bytes, 4294967296 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sdf: 2199.0 GB, 2199023255552 bytes, 4294967296 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sda: 536.9 GB, 536870912000 bytes, 1048576000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0008ce60
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 1048567807 523234304 8e Linux LVM
Disk /dev/mapper/vg_root-lv_root: 64.4 GB, 64424509440 bytes, 125829120 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/vg_root-lv_swap: 68.7 GB, 68719476736 bytes, 134217728 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/vg_root-lv_data: 209.4 GB, 209371267072 bytes, 408928256 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/vg_root-lv_home: 64.4 GB, 64424509440 bytes, 125829120 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/vg_root-oracle: 64.4 GB, 64424509440 bytes, 125829120 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/vg_root-lv_grid: 64.4 GB, 64424509440 bytes, 125829120 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
Disk /dev/sdg: 2199.0 GB, 2199023255552 bytes, 4294967296 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: gpt
Disk identifier: 9C5E039C-2C6C-4585-8EAB-7B2DBA949516
# Start End Size Type Name
1 34 4294965343 2T Linux LVM primary
[root@jylhlog2 ~]#
2. 创建pv、扩容vg、扩容lv、扩容xfs分区
2.1 查看目前分区情况
[root@jylhlog2 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_root-lv_root 60G 6.2G 54G 11% /
devtmpfs 63G 0 63G 0% /dev
tmpfs 63G 640M 63G 1% /dev/shm
tmpfs 63G 32M 63G 1% /run
tmpfs 63G 0 63G 0% /sys/fs/cgroup
/dev/sda1 1014M 179M 836M 18% /boot
/dev/mapper/vg_root-lv_grid 60G 40G 21G 66% /grid
/dev/mapper/vg_root-lv_data 195G 595M 195G 1% /data
/dev/mapper/vg_root-oracle 60G 22G 38G 37% /oracle
/dev/mapper/vg_root-lv_home 60G 16G 45G 27% /home
tmpfs 13G 12K 13G 1% /run/user/42
tmpfs 13G 0 13G 0% /run/user/1000
[root@jylhlog2 ~]#
2.2 查看目前lv情况
[root@jylhlog2 ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
lv_data vg_root -wi-ao---- 194.99g
lv_grid vg_root -wi-ao---- 60.00g
lv_home vg_root -wi-ao---- 60.00g
lv_root vg_root -wi-ao---- 60.00g
lv_swap vg_root -wi-ao---- 64.00g
oracle vg_root -wi-ao---- 60.00g
[root@jylhlog2 ~]#
2.3 查看目前vg情况
[root@jylhlog2 ~]# vgs
VG #PV #LV #SN Attr VSize VFree
vg_root 1 6 0 wz–n- 498.99g 0
[root@jylhlog2 ~]#
2.4 创建pv
[root@jylhlog2 ~]# pvcreate /dev/sdg1
Physical volume “/dev/sdg1” successfully created.
[root@jylhlog2 ~]#
2.5 扩容vg
[root@jylhlog2 ~]# vgextend vg_root /dev/sdg1
Volume group “vg_root” successfully extended
[root@jylhlog2 ~]#
2.6 查看vg扩容情况
[root@jylhlog2 ~]# vgs
VG #PV #LV #SN Attr VSize VFree
vg_root 2 6 0 wz–n- <2.49t <2.00t
[root@jylhlog2 ~]#
2.7 查看扩容后vg大小情况
[root@jylhlog2 ~]# vgdisplay
— Volume group —
VG Name vg_root
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 8
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 6
Open LV 6
Max PV 0
Cur PV 2
Act PV 2
VG Size <2.49 TiB
PE Size 4.00 MiB
Total PE 652029
Alloc PE / Size 127742 / 498.99 GiB
Free PE / Size 524287 / <2.00 TiB
VG UUID bV0qQR-Vhfg-ynTF-dbza-qJD1-ao3k-l02WiP
[root@jylhlog2 ~]#
2.8 扩容lv
[root@jylhlog2 ~]# lvextend -L +2097148M /dev/mapper/vg_root-lv_data
Size of logical volume vg_root/lv_data changed from 194.99 GiB (49918 extents) to 2.19 TiB (574205 extents).
Logical volume vg_root/lv_data successfully resized.
[root@jylhlog2 ~]#
2.9 查看容量变化,发现文件系统大小没有变化
[root@jylhlog2 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_root-lv_root 60G 6.2G 54G 11% /
devtmpfs 63G 0 63G 0% /dev
tmpfs 63G 640M 63G 1% /dev/shm
tmpfs 63G 32M 63G 1% /run
tmpfs 63G 0 63G 0% /sys/fs/cgroup
/dev/sda1 1014M 179M 836M 18% /boot
/dev/mapper/vg_root-lv_grid 60G 40G 21G 66% /grid
/dev/mapper/vg_root-lv_data 195G 595M 195G 1% /data
/dev/mapper/vg_root-oracle 60G 22G 38G 37% /oracle
/dev/mapper/vg_root-lv_home 60G 16G 45G 27% /home
tmpfs 13G 12K 13G 1% /run/user/42
tmpfs 13G 0 13G 0% /run/user/1000
[root@jylhlog2 ~]#
2.10 使用xfs_growfs同步磁盘信息
[root@jylhlog2 ~]# xfs_growfs /dev/mapper/vg_root-lv_data
meta-data=/dev/mapper/vg_root-lv_data isize=512 agcount=4, agsize=12779008 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=51116032, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=24959, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 51116032 to 587985920
[root@jylhlog2 ~]#
2.11 查看容量变化,发现文件系统已扩容成功
[root@jylhlog2 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_root-lv_root 60G 6.2G 54G 11% /
devtmpfs 63G 0 63G 0% /dev
tmpfs 63G 640M 63G 1% /dev/shm
tmpfs 63G 32M 63G 1% /run
tmpfs 63G 0 63G 0% /sys/fs/cgroup
/dev/sda1 1014M 179M 836M 18% /boot
/dev/mapper/vg_root-lv_grid 60G 40G 21G 66% /grid
/dev/mapper/vg_root-lv_data 2.2T 597M 2.2T 1% /data
/dev/mapper/vg_root-oracle 60G 22G 38G 37% /oracle
/dev/mapper/vg_root-lv_home 60G 16G 45G 27% /home
tmpfs 13G 12K 13G 1% /run/user/42
tmpfs 13G 0 13G 0% /run/user/1000
[root@jylhlog2 ~]#
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
如果sdb1是一个磁盘阵列,而这个磁盘阵列使用年代太久,我们必须移出怎么办?
移动数据: [root@test1 ~]# pvmove /dev/sdb1 /dev/sdb3 #将sdb1上数据移到新增加sdb3 pv 上 /dev/sdb1: Moved: 23.53% /dev/sdb1: Moved: 76.47% /dev/sdb1: Moved: 100.00% [root@test1 ~]# vgreduce vg01 /dev/sdb1 #移完数据再移出 Removed "/dev/sdb1" from volume group "vg01" [root@test1 ~]# pvs PV VG Fmt Attr PSize PFree /dev/sdb1 lvm2 --- 1.00g 1.00g /dev/sdb2 vg02 lvm2 a-- 1008.00m 1008.00m /dev/sdb3 vg01 lvm2 a-- 1020.00m 952.00m #vg01中只有sdb3了