秒懂linux系统管理-逻辑卷实战案例-其他常见操作

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
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

大数据卷神

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值