LVM中有PV出现了坏道
#LVM中有PV出现了坏道
#数据拷贝 将/dev/sdc1拷贝到/dev/sdd1
[root@wing ~]#lvchange -an /dev/wing/abc
[root@wing ~]# pvmove /dev/sdc1 /dev/sdd1
/dev/sdc1: Moved: 2.7%
/dev/sdc1: Moved: 100.0%
[root@wing ~]# vgchange -a n /dev/wing
0 logical volume(s) in volume group "wing" now active
[root@wing ~]# vgreduce wing /dev/sdc1
Removed "/dev/sdc1" from volume group "wing"
[root@wing ~]# vgchange -a y /dev/wing
1 logical volume(s) in volume group "wing" now active
[root@wing ~]#lvchange -ay /dev/wing/abc
#卷组迁移
#导出卷组 old machine
[root@wing ~]# vgexport /dev/wing
Volume group "wing" successfully exported
#导入卷组 new machine
[root@wing ~]# pvscan
[root@wing ~]# vgimport /dev/wing
Volume group "wing" successfully imported
[root@wing ~]# vgchange -a y /dev/wing
1 logical volume(s) in volume group "wing" now active
[root@wing ~]#lvchange -ay /dev/wing/abc
volume merged lv合并
root@wing lvm]# vgcreate wing1 /dev/sdc1
Volume group "wing1" successfully created
[root@wing lvm]# vgcreate wing2 /dev/sdd1
Volume group "wing2" successfully created
[root@wing lvm]# vgmerge -v wing1 wing2
Checking for volume group "wing1"
Checking for volume group "wing2"
Archiving volume group "wing2" metadata (seqno 1).
Archiving volume group "wing1" metadata (seqno 1).
Writing out updated volume group
Creating volume group backup "/etc/lvm/backup/wing1" (seqno 2).
Volume group "wing2" successfully merged into "wing1"
volume spilt lv分割
[root@wing ~]# vgsplit wing1 wing2 /dev/sdd1
New volume group "wing2" successfully split from "wing1"
wing1 Old volume
wing2 New volume /dev/sdd1
逻辑卷从旧机器迁移到新机器
#########Backing Up Volume Group Metadata:
当创建vg的时候,系统默认会自动备份Metadata。/etc/lvm/backup下面存放的是metadata的备份信息,而/etc/lvm/archive下面存放的是metadata的archive信息。
[root@wing backup]# pwd
/etc/lvm/backup
[root@wing backup]# strings wing2
# 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 wing1 wing2 /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
wing2 {
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