共计 2366 个字符,预计需要花费 6 分钟才能阅读完成。
LVM 中有 PV 出现了坏道
#LVM 中有 PV 出现了坏道
#数据拷贝 将 /dev/sdc1 拷贝到 /dev/sdd1
[root@zutuanxue ~]#lvchange -an /dev/baism/abc
[root@zutuanxue ~]# pvmove /dev/sdc1 /dev/sdd1
/dev/sdc1: Moved: 2.7%
/dev/sdc1: Moved: 100.0%
[root@zutuanxue ~]# vgchange -a n /dev/baism
0 logical volume(s) in volume group "baism" now active
[root@zutuanxue ~]# vgreduce baism /dev/sdc1
Removed "/dev/sdc1" from volume group "baism"
[root@zutuanxue ~]# vgchange -a y /dev/baism
1 logical volume(s) in volume group "baism" now active
[root@zutuanxue ~]#lvchange -ay /dev/baism/abc
#卷组迁移
#导出卷组 old machine
[root@zutuanxue ~]# vgexport /dev/baism
Volume group "baism" successfully exported
#导入卷组 new machine
[root@zutuanxue ~]# pvscan
[root@zutuanxue ~]# vgimport /dev/baism
Volume group "baism" successfully imported
[root@zutuanxue ~]# vgchange -a y /dev/baism
1 logical volume(s) in volume group "baism" now active
[root@zutuanxue ~]#lvchange -ay /dev/baism/abc
volume merged lv 合并
root@zutuanxue lvm]# vgcreate baism1 /dev/sdc1
Volume group "baism1" successfully created
[root@zutuanxue lvm]# vgcreate baism2 /dev/sdd1
Volume group "baism2" successfully created
[root@zutuanxue lvm]# vgmerge -v baism1 baism2
Checking for volume group "baism1"
Checking for volume group "baism2"
Archiving volume group "baism2" metadata (seqno 1).
Archiving volume group "baism1" metadata (seqno 1).
Writing out updated volume group
Creating volume group backup "/etc/lvm/backup/baism1" (seqno 2).
Volume group "baism2" successfully merged into "baism1"
volume spilt lv 分割
[root@zutuanxue ~]# vgsplit baism1 baism2 /dev/sdd1
New volume group "baism2" successfully split from "baism1"
baism1 Old volume
baism2 New volume /dev/sdd1
逻辑卷从旧机器迁移到新机器
#########Backing Up Volume Group Metadata:
当创建 vg 的时候,系统默认会自动备份 Metadata。/etc/lvm/backup 下面存放的是 metadata 的备份信息,而 /etc/lvm/archive 下面存放的是 metadata 的 archive 信息。[root@zutuanxue backup]# pwd
/etc/lvm/backup
[root@zutuanxue backup]# strings baism2
# Generated by LVM2 version 2.02.87(2)-rhel7 (2011-10-12): Mon Jan 14 22:27:02 2013
contents = "Text Format Volume Group"
version = 1
description = "Created *after* executing'vgsplit baism1 baism2 /dev/sdd1'" #warn
creation_host = "rhel7" # Linux rhel7 2.6.32-220.el6.x86_64 #1 SMP Wed Nov 9 08:03:13 EST 2011 x86_64
creation_time = 1358173622 # Mon Jan 14 22:27:02 2013
baism2 {
id = "Ft0eD7-oVca-mwY6-6FeK-TwW2-hTrj-aYxYbq"
seqno = 2
status = ["RESIZEABLE", "READ", "WRITE"]
flags = []
extent_size = 8192 # 4 Megabytes
max_lv = 0
max_pv = 0
metadata_copies = 0
physical_volumes {
pv0 {
id = "m7aKrr-D0r9-jOJ2-aK51-ec25-4rwH-4ccbbh"
device = "/dev/sdd1" # Hint only
status = ["ALLOCATABLE"]
flags = []
dev_size = 4192902 # 1.99933 Gigabytes
pe_start = 2048
pe_count = 511 # 1.99609 Gigabytes
正文完
星哥玩云-微信公众号