案例说明
Centos7
VG:vg LV:vg-lv
Redhat 7.5
VG:vgtest LV:lvtest
目的:模拟硬盘 /dev/sdb损坏、在线添加新硬盘/dev/sdc,lv镜像数据同步
Last login: Thu Nov 15 07:10:20 2018 from 192.168.31.220
[root@web02 ~]# df -h ###查看文件系统
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 47G 1.6G 43G 4% /
tmpfs 246M 0 246M 0% /dev/shm
/dev/sda1 976M 39M 886M 5% /boot
/dev/mapper/vg-lv 5.8G 12M 5.5G 1% /dd_data
[root@web02 ~]# lsblk ###查看硬盘分区信息
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 1024M 0 rom
sda 8:0 0 50G 0 disk
├─sda1 8:1 0 1G 0 part /boot
├─sda2 8:2 0 47.5G 0 part /
└─sda3 8:3 0 1.5G 0 part [SWAP]
sdb 8:16 0 10G 0 disk
└─sdb1 8:17 0 10G 0 part
└─vg-lv_mimage_0 (dm-1) 253:1 0 6G 0 lvm
└─vg-lv (dm-3) 253:3 0 6G 0 lvm /dd_data
sdd 8:48 0 10G 0 disk
└─sdd1 8:49 0 10G 0 part
├─vg-lv_mlog (dm-0) 253:0 0 4M 0 lvm
│ └─vg-lv (dm-3) 253:3 0 6G 0 lvm /dd_data
└─vg-lv_mimage_1 (dm-2) 253:2 0 6G 0 lvm
└─vg-lv (dm-3) 253:3 0 6G 0 lvm /dd_data [root@web02 ~]# lvdisplay ###查看lv信息
--- Logical volume ---
LV Path /dev/vg/lv
LV Name lv
VG Name vg
LV UUID bm5k1e-hD8k-cZhf-EfD9-NP2g-Scr0-Meh8Yr
LV Write Access read/write
LV Creation host, time web02.riyimei.cn, 2018-11-15 07:53:10 +0000
LV Status available
# open 1
LV Size 6.00 GiB
Current LE 1536
Mirrored volumes 2 ###镜像数量
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:3 [root@web02 dd_data]# pvs ###查看pv信息
PV VG Fmt Attr PSize PFree
/dev/sdb1 vg lvm2 a--u 10.00g 4.00g
/dev/sdd1 vg lvm2 a--u 9.99g 3.99g
[root@web02 ~]# dd if=/dev/zero of=/dev/sdb1 count=10    ###损坏/dev/sdb的数据信息
10+0 records in
10+0 records out
5120 bytes (5.1 kB) copied, 0.00133574 s, 3.8 MB/s
[root@web02 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 1024M 0 rom
sda 8:0 0 50G 0 disk
├─sda1 8:1 0 1G 0 part /boot
├─sda2 8:2 0 47.5G 0 part /
└─sda3 8:3 0 1.5G 0 part [SWAP]
sdb 8:16 0 10G 0 disk
└─sdb1 8:17 0 10G 0 part
└─vg-lv_mimage_0 (dm-1) 253:1 0 6G 0 lvm
└─vg-lv (dm-3) 253:3 0 6G 0 lvm /dd_data
sdd 8:48 0 10G 0 disk
└─sdd1 8:49 0 10G 0 part
├─vg-lv_mlog (dm-0) 253:0 0 4M 0 lvm
│ └─vg-lv (dm-3) 253:3 0 6G 0 lvm /dd_data
└─vg-lv_mimage_1 (dm-2) 253:2 0 6G 0 lvm
└─vg-lv (dm-3) 253:3 0 6G 0 lvm /dd_data
[root@web02 ~]# lvs ###查看lv出现报错
Couldn't find device with uuid XvYP09-jmxl-A6Pl-ViMz-t0k8-AwWd-5IUbWv.
Couldn't find device for segment belonging to vg/lv_mimage_0 while checking used and assumed devices.
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
lv vg mwi-aom-p- 6.00g [lv_mlog] 100.00
[root@web02 ~]# vgs ###vg也出现报错
Couldn't find device with uuid XvYP09-jmxl-A6Pl-ViMz-t0k8-AwWd-5IUbWv.
Couldn't find device for segment belonging to vg/lv_mimage_0 while checking used and assumed devices.
VG #PV #LV #SN Attr VSize VFree
vg 2 1 0 wz-pn- 19.99g 7.98g
[root@web02 ~]# pvs ###查看pv信息提示有一块硬盘无法识别
Couldn't find device with uuid XvYP09-jmxl-A6Pl-ViMz-t0k8-AwWd-5IUbWv.
Couldn't find device for segment belonging to vg/lv_mimage_0 while checking used and assumed devices.
PV VG Fmt Attr PSize PFree
/dev/sdd1 vg lvm2 a--u 9.99g 3.99g
unknown device vg lvm2 a-mu 10.00g 4.00g

在线添加新硬盘

[root@web02 ~]# fdisk /dev/sd
sda sda1 sda2 sda3 sdb sdb1 sdd sdd1
[root@web02 ~]# fdisk /dev/sd^C
[root@web02 ~]# echo "- - -" > /sys/class/scsi_host/host0/scan ###刷新硬盘
[root@web02 ~]# echo "- - -" > /sys/class/scsi_host/host1/scan
[root@web02 ~]# echo "- - -" > /sys/class/scsi_host/host2/scan
[root@web02 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 1024M 0 rom
sda 8:0 0 50G 0 disk
├─sda1 8:1 0 1G 0 part /boot
├─sda2 8:2 0 47.5G 0 part /
└─sda3 8:3 0 1.5G 0 part [SWAP]
sdb 8:16 0 10G 0 disk
└─sdb1 8:17 0 10G 0 part
└─vg-lv_mimage_0 (dm-1) 253:1 0 6G 0 lvm
└─vg-lv (dm-3) 253:3 0 6G 0 lvm /dd_data
sdd 8:48 0 10G 0 disk
└─sdd1 8:49 0 10G 0 part
├─vg-lv_mlog (dm-0) 253:0 0 4M 0 lvm
│ └─vg-lv (dm-3) 253:3 0 6G 0 lvm /dd_data
└─vg-lv_mimage_1 (dm-2) 253:2 0 6G 0 lvm
└─vg-lv (dm-3) 253:3 0 6G 0 lvm /dd_data
sdc 8:32 0 10G 0 disk ###新添加的硬盘
[root@web02 ~]# fdisk -l /dev/sdc ###查看核实新硬盘信息 Disk /dev/sdc: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000 [root@web02 ~]# fdisk /dev/sdc ###对新硬盘分区,做成lvm格式
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xc9fa05fb.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable. Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u'). Command (m for help): n ###新建分区
Command action
e extended
p primary partition (1-4)
p ### 主分区
Partition number (1-4): 1 ###设置为1分区
First cylinder (1-1305, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-1305, default 1305):
Using default value 1305 Command (m for help): t ###分区类型
Selected partition 1
Hex code (type L to list codes): 8e lvm格式分区
Changed system type of partition 1 to 8e (Linux LVM) Command (m for help): p ###打印分区信息 Disk /dev/sdc: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xc9fa05fb Device Boot Start End Blocks Id System
/dev/sdc1 1 1305 10482381 8e Linux LVM Command (m for help): w ###写入分区信息
The partition table has been altered! Calling ioctl() to re-read partition table.
Syncing disks.
[root@web02 ~]# lsblk ###查看新硬盘分区
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 1024M 0 rom
sda 8:0 0 50G 0 disk
├─sda1 8:1 0 1G 0 part /boot
├─sda2 8:2 0 47.5G 0 part /
└─sda3 8:3 0 1.5G 0 part [SWAP]
sdb 8:16 0 10G 0 disk
└─sdb1 8:17 0 10G 0 part
└─vg-lv_mimage_0 (dm-1) 253:1 0 6G 0 lvm
└─vg-lv (dm-3) 253:3 0 6G 0 lvm /dd_data
sdd 8:48 0 10G 0 disk
└─sdd1 8:49 0 10G 0 part
├─vg-lv_mlog (dm-0) 253:0 0 4M 0 lvm
│ └─vg-lv (dm-3) 253:3 0 6G 0 lvm /dd_data
└─vg-lv_mimage_1 (dm-2) 253:2 0 6G 0 lvm
└─vg-lv (dm-3) 253:3 0 6G 0 lvm /dd_data
sdc 8:32 0 10G 0 disk
└─sdc1 8:33 0 10G 0 part
[root@web02 ~]# lvs -a -o +devices ###查看lv的激活信息状态
Couldn't find device with uuid XvYP09-jmxl-A6Pl-ViMz-t0k8-AwWd-5IUbWv.
Couldn't find device for segment belonging to vg/lv_mimage_0 while checking used and assumed devices.
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert Devices
lv vg mwi-aom-p- 6.00g [lv_mlog] 100.00 lv_mimage_0(0),lv_mimage_1(0)
[lv_mimage_0] vg iwi-aom-p- 6.00g unknown device(0)
[lv_mimage_1] vg iwi-aom--- 6.00g /dev/sdd1(0)
[lv_mlog] vg lwi-aom--- 4.00m /dev/sdd1(1536) [root@web02 ~]# pvcreate /dev/sdc1 ###把 /dev/sdc1 创建成pv
Couldn't find device with uuid XvYP09-jmxl-A6Pl-ViMz-t0k8-AwWd-5IUbWv.
Couldn't find device for segment belonging to vg/lv_mimage_0 while checking used and assumed devices.
Physical volume "/dev/sdc1" successfully created
[root@web02 ~]# pvs ###查看pv /dev/sdc1
Couldn't find device with uuid XvYP09-jmxl-A6Pl-ViMz-t0k8-AwWd-5IUbWv.
Couldn't find device for segment belonging to vg/lv_mimage_0 while checking used and assumed devices.
PV VG Fmt Attr PSize PFree
/dev/sdc1 lvm2 ---- 10.00g 10.00g
/dev/sdd1 vg lvm2 a--u 9.99g 3.99g
unknown device vg lvm2 a-mu 10.00g 4.00g

  

####将坏掉的设备删除lv镜像自动删除
***重要一定要先将坏的硬盘解除vg

[root@web02 dd_data]# vgreduce --removemissing --force vg     ###坏盘自动解除:--force后面添加有坏盘的vg名称
Couldn't find device with uuid XvYP09-jmxl-A6Pl-ViMz-t0k8-AwWd-5IUbWv.
Couldn't find device for segment belonging to vg/lv_mimage_0 while checking used and assumed devices.
Couldn't find device for segment belonging to vg/lv_mimage_0 while checking used and assumed devices.
Wrote out consistent volume group vg [root@web02 dd_data]# pvs
PV VG Fmt Attr PSize PFree
/dev/sdc1 lvm2 ---- 10.00g 10.00g
/dev/sdd1 vg lvm2 a--u 9.99g 3.99g [root@web02 dd_data]# vgextend vg /dev/sdc1 ###把新硬盘添加的vg
Volume group "vg" successfully extended
[root@web02 dd_data]# pvs
PV VG Fmt Attr PSize PFree
/dev/sdc1 vg lvm2 a--u 9.99g 9.99g
/dev/sdd1 vg lvm2 a--u 9.99g 3.99g
[root@web02 dd_data]# vgs
VG #PV #LV #SN Attr VSize VFree
vg 2 1 0 wz--n- 19.98g 13.98g [root@web02 dd_data]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
lv vg -wi-ao---- 6.00g

将新硬盘添加到lv镜像数据同步(可以不添加/dev/sdd1:lvconvert -m1 /dev/vg/lv /dev/sdc1 )

[root@web02 dd_data]# lvconvert -m1 /dev/vg/lv /dev/sdd1 /dev/sdc1
vg/lv: Converted: 0.0%
vg/lv: Converted: 4.7%
vg/lv: Converted: 9.4%
vg/lv: Converted: 14.1%
vg/lv: Converted: 18.9%
vg/lv: Converted: 23.7%
vg/lv: Converted: 28.4%
vg/lv: Converted: 33.0%
vg/lv: Converted: 37.9%
vg/lv: Converted: 42.8%
vg/lv: Converted: 47.6%
vg/lv: Converted: 52.3%
vg/lv: Converted: 57.0%
vg/lv: Converted: 61.8%
vg/lv: Converted: 66.7%
vg/lv: Converted: 71.5%
vg/lv: Converted: 76.4%
vg/lv: Converted: 81.3%
vg/lv: Converted: 86.1%
vg/lv: Converted: 90.8%
vg/lv: Converted: 95.4%
vg/lv: Converted: 100.0% [root@web02 dd_data]# lvs -a -o +devices
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert Devices
lv vg mwi-aom--- 6.00g [lv_mlog] 100.00 lv_mimage_0(0),lv_mimage_1(0)
[lv_mimage_0] vg iwi-aom--- 6.00g /dev/sdd1(0)
[lv_mimage_1] vg iwi-aom--- 6.00g /dev/sdc1(0)
[lv_mlog] vg lwi-aom--- 4.00m /dev/sdc1(1536)
[root@web02 dd_data]# lvdisplay
--- Logical volume ---
LV Path /dev/vg/lv
LV Name lv
VG Name vg
LV UUID bm5k1e-hD8k-cZhf-EfD9-NP2g-Scr0-Meh8Yr
LV Write Access read/write
LV Creation host, time web02.riyimei.cn, 2018-11-15 07:53:10 +0000
LV Status available
# open 1
LV Size 6.00 GiB
Current LE 1536
Mirrored volumes 2
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:3 [root@web02 dd_data]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
lv vg mwi-aom--- 6.00g [lv_mlog] 100.00
[root@web02 dd_data]# vgs
VG #PV #LV #SN Attr VSize VFree
vg 2 1 0 wz--n- 19.98g 7.98g
[root@web02 dd_data]# pvs
PV VG Fmt Attr PSize PFree
/dev/sdc1 vg lvm2 a--u 9.99g 3.99g
/dev/sdd1 vg lvm2 a--u 9.99g 3.99g [root@web02 dd_data]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 47G 1.6G 43G 4% /
tmpfs 246M 0 246M 0% /dev/shm
/dev/sda1 976M 39M 886M 5% /boot
/dev/mapper/vg-lv 5.8G 12M 5.5G 1% /dd_data [root@web02 dd_data]# ls
liweiming lost+found test
[root@web02 dd_data]# lvdisplay -m
--- Logical volume ---
LV Path /dev/vg/lv
LV Name lv
VG Name vg
LV UUID bm5k1e-hD8k-cZhf-EfD9-NP2g-Scr0-Meh8Yr
LV Write Access read/write
LV Creation host, time web02.riyimei.cn, 2018-11-15 07:53:10 +0000
LV Status available
# open 1
LV Size 6.00 GiB
Current LE 1536
Mirrored volumes 2
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:3 --- Segments ---
Logical extents 0 to 1535:
Type mirror
Monitoring monitored
Mirrors 2
Mirror size 1536
Mirror log volume lv_mlog
Mirror region size 512.00 KiB
Mirror original:
Logical volume lv_mimage_0
Logical extents 0 to 1535
Mirror destinations:
Logical volume lv_mimage_1
Logical extents 0 to 1535
[root@web02 dd_data]# lvs -a -o name,copy_percent,devices vg
LV Cpy%Sync Devices
lv 100.00 lv_mimage_0(0),lv_mimage_1(0)
[lv_mimage_0] /dev/sdd1(0)
[lv_mimage_1] /dev/sdc1(0)
[lv_mlog] /dev/sdc1(1536)
[root@web02 dd_data]# lvs --all --segments -o +devices
LV VG Attr #Str Type SSize Devices
lv vg mwi-aom--- 2 mirror 6.00g lv_mimage_0(0),lv_mimage_1(0)
[lv_mimage_0] vg iwi-aom--- 1 linear 6.00g /dev/sdd1(0)
[lv_mimage_1] vg iwi-aom--- 1 linear 6.00g /dev/sdc1(0)
[lv_mlog] vg lwi-aom--- 1 linear 4.00m /dev/sdc1(1536)
[root@web02 dd_data]#

Redhat7.5

##解除镜像、转回线性逻辑卷
[root@lvm ~]# lvconvert -m0 /dev/mapper/vgtest-lvtest
Are you sure you want to convert raid1 LV vgtest/lvtest to type linear losing all resilience? [y/n]: y
Logical volume vgtest/lvtest successfully converted. [root@lvm ~]# lvdisplay -m
--- Logical volume ---
LV Path /dev/vgtest/lvtest
LV Name lvtest
VG Name vgtest
LV UUID SYCcLe-3RgP-aUj0-Fnef-eODz-cLoK-YtF4iM
LV Write Access read/write
LV Creation host, time lvm, 2018-11-27 15:20:19 +0800
LV Status available
# open 1
LV Size 5.00 GiB
Current LE 1280
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:9 --- Segments ---
Logical extents 0 to 1279:
Type linear
Physical volume /dev/sdd1
Physical extents 1 to 1280 --- Logical volume ---
LV Path /dev/vg_root/lv_opt
LV Name lv_opt
VG Name vg_root
LV UUID 24eBV3-UY8L-Yuel-2jKm-VlDC-sQMV-zQODY7
LV Write Access read/write
LV Creation host, time localhost, 2018-11-15 14:32:30 +0800
LV Status available
# open 1
LV Size <15.50 GiB
Current LE 3967
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:1 --- Segments ---
Logical extents 0 to 3966:
Type linear
Physical volume /dev/sda3
Physical extents 0 to 3966 --- Logical volume ---
LV Path /dev/vg_root/lv_tmp
LV Name lv_tmp
VG Name vg_root
LV UUID 73xbdz-RV5j-ifd0-npSE-g2Ut-6P52-dHyhaZ
LV Write Access read/write
LV Creation host, time localhost, 2018-11-15 14:32:32 +0800
LV Status available
# open 1
LV Size 4.00 GiB
Current LE 1024
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:2 --- Segments ---
Logical extents 0 to 1023:
Type linear
Physical volume /dev/sda3
Physical extents 3967 to 4990 --- Logical volume ---
LV Path /dev/vg_root/lv_home
LV Name lv_home
VG Name vg_root
LV UUID 7TzF7z-l4eL-LcZl-Dv6h-nfCC-3Ysd-HnhNqb
LV Write Access read/write
LV Creation host, time localhost, 2018-11-15 14:32:34 +0800
LV Status available
# open 1
LV Size 4.00 GiB
Current LE 1024
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:3 --- Segments ---
Logical extents 0 to 1023:
Type linear
Physical volume /dev/sda3
Physical extents 4991 to 6014 --- Logical volume ---
LV Path /dev/vg_root/lv_var
LV Name lv_var
VG Name vg_root
LV UUID fnck2V-dYdH-3h0R-qXai-Y1pz-YoDn-Xd1t0c
LV Write Access read/write
LV Creation host, time localhost, 2018-11-15 14:32:35 +0800
LV Status available
# open 1
LV Size 10.00 GiB
Current LE 2560
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:4 --- Segments ---
Logical extents 0 to 2559:
Type linear
Physical volume /dev/sda3
Physical extents 6015 to 8574 --- Logical volume ---
LV Path /dev/vg_root/lv_root
LV Name lv_root
VG Name vg_root
LV UUID leRKJl-a7xF-k5pH-uCcl-3fHa-m6Os-gVDW07
LV Write Access read/write
LV Creation host, time localhost, 2018-11-15 14:32:37 +0800
LV Status available
# open 1
LV Size 15.00 GiB
Current LE 3840
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:0 --- Segments ---
Logical extents 0 to 3839:
Type linear
Physical volume /dev/sda3
Physical extents 8575 to 12414 ##扫出需要做镜像的硬盘
[root@lvm ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda3 vg_root lvm2 a-- <48.50g 0
/dev/sdd1 vgtest lvm2 a-- <10.00g <5.00g
/dev/sde1 vgtest lvm2 a-- <10.00g <10.00g ## 把线性逻辑卷做出镜像逻辑 镜像备份1份
[root@lvm ~]# lvconvert -m 1 /dev/mapper/vgtest-lvtest /dev/sdd1 /dev/sde1
Are you sure you want to convert linear LV vgtest/lvtest to raid1 with 2 images enhancing resilience? [y/n]: y
Logical volume vgtest/lvtest successfully converted.
[root@lvm ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
lv_home vg_root -wi-ao---- 4.00g
lv_opt vg_root -wi-ao---- <15.50g
lv_root vg_root -wi-ao---- 15.00g
lv_tmp vg_root -wi-ao---- 4.00g
lv_var vg_root -wi-ao---- 10.00g
lvtest vgtest rwi-aor--- 5.00g 0.62
[root@lvm ~]# lvs -a -o +devices
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert Devices
lv_home vg_root -wi-ao---- 4.00g /dev/sda3(4991)
lv_opt vg_root -wi-ao---- <15.50g /dev/sda3(0)
lv_root vg_root -wi-ao---- 15.00g /dev/sda3(8575)
lv_tmp vg_root -wi-ao---- 4.00g /dev/sda3(3967)
lv_var vg_root -wi-ao---- 10.00g /dev/sda3(6015)
lvtest vgtest rwi-aor--- 5.00g 6.20 lvtest_rimage_0(0),lvtest_rimage_1(0)
[lvtest_rimage_0] vgtest iwi-aor--- 5.00g /dev/sdd1(1)
[lvtest_rimage_1] vgtest Iwi-aor--- 5.00g /dev/sde1(1)
[lvtest_rmeta_0] vgtest ewi-aor--- 4.00m /dev/sdd1(0)
[lvtest_rmeta_1] vgtest ewi-aor--- 4.00m /dev/sde1(0)
[root@lvm ~]# lvs -a -o name,copy_percent,devices vgtest
LV Cpy%Sync Devices
lvtest 14.68 lvtest_rimage_0(0),lvtest_rimage_1(0)
[lvtest_rimage_0] /dev/sdd1(1)
[lvtest_rimage_1] /dev/sde1(1)
[lvtest_rmeta_0] /dev/sdd1(0)
[lvtest_rmeta_1] /dev/sde1(0)
[BEGIN] 2018/11/27 22:23:20
Connection established.
To escape to local shell, press Ctrl+Alt+].
Last login: Tue Nov 27 16:02:26 2018 from 172-5-0-243.lightspeed.oshkwi.sbcglobal.net
[root@lvm ~]#
[root@lvm ~]# lvs -a -o name,copy_percent,devices vgtest
LV Cpy%Sync Devices
lvtest 100.00 lvtest_rimage_0(0),lvtest_rimage_1(0)
[lvtest_rimage_0]
[lvtest_rimage_1] /dev/sdd1(1)
[lvtest_rmeta_0]
[lvtest_rmeta_1] /dev/sdd1(0) [root@lvm ~]# lvs -a -o +devices
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert Devices
lv_home vg_root -wi-ao---- 4.00g /dev/sda3(4991)
lv_opt vg_root -wi-ao---- <15.50g /dev/sda3(0)
lv_root vg_root -wi-ao---- 15.00g /dev/sda3(8575)
lv_tmp vg_root -wi-ao---- 4.00g /dev/sda3(3967)
lv_var vg_root -wi-ao---- 10.00g /dev/sda3(6015)
lvtest vgtest rwi-aor-r- 5.00g 100.00 lvtest_rimage_0(0),lvtest_rimage_1(0)
[lvtest_rimage_0] vgtest vwi-aor-r- 5.00g
[lvtest_rimage_1] vgtest iwi-aor--- 5.00g /dev/sdd1(1)
[lvtest_rmeta_0] vgtest ewi-aor-r- 4.00m
[lvtest_rmeta_1] vgtest ewi-aor--- 4.00m /dev/sdd1(0)
[root@lvm ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda3 vg_root lvm2 a-- <48.50g 0
/dev/sdd1 vgtest lvm2 a-- <10.00g 4.99g
/dev/sde1 vgtest lvm2 a-- <10.00g <10.00g
[root@lvm ~]# vgs
VG #PV #LV #SN Attr VSize VFree
vg_root 1 5 0 wz--n- <48.50g 0
vgtest 2 1 0 wz--n- 19.99g <14.99g
[root@lvm ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
lv_home vg_root -wi-ao---- 4.00g
lv_opt vg_root -wi-ao---- <15.50g
lv_root vg_root -wi-ao---- 15.00g
lv_tmp vg_root -wi-ao---- 4.00g
lv_var vg_root -wi-ao---- 10.00g
lvtest vgtest rwi-aor-r- 5.00g 100.00
[root@lvm ~]# lvconvert -m1 /dev/vgtest/lvtest /dev/sdd1 /dev/sde1
Are you sure you want to convert raid1 LV vgtest/lvtest to 2 images enhancing resilience? [y/n]: y
WARNING: vgtest/lvtest already has image count of 2.
Logical volume vgtest/lvtest successfully converted.
[root@lvm ~]# lvs -a -o +devices
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert Devices
lv_home vg_root -wi-ao---- 4.00g /dev/sda3(4991)
lv_opt vg_root -wi-ao---- <15.50g /dev/sda3(0)
lv_root vg_root -wi-ao---- 15.00g /dev/sda3(8575)
lv_tmp vg_root -wi-ao---- 4.00g /dev/sda3(3967)
lv_var vg_root -wi-ao---- 10.00g /dev/sda3(6015)
lvtest vgtest rwi-aor-r- 5.00g 100.00 lvtest_rimage_0(0),lvtest_rimage_1(0)
[lvtest_rimage_0] vgtest vwi-aor-r- 5.00g
[lvtest_rimage_1] vgtest iwi-aor--- 5.00g /dev/sdd1(1)
[lvtest_rmeta_0] vgtest ewi-aor-r- 4.00m
[lvtest_rmeta_1] vgtest ewi-aor--- 4.00m /dev/sdd1(0)
[root@lvm ~]# lvconvert --repair /dev/mapper/vgtest-lvtest
WARNING: Disabling lvmetad cache for repair command.
WARNING: Not using lvmetad because of repair.
Attempt to replace failed RAID images (requires full device resync)? [y/n]: y
Faulty devices in vgtest/lvtest successfully replaced.
[root@lvm ~]# lvs -a -o +devices
WARNING: Not using lvmetad because a repair command was run.
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert Devices
lv_home vg_root -wi-ao---- 4.00g /dev/sda3(4991)
lv_opt vg_root -wi-ao---- <15.50g /dev/sda3(0)
lv_root vg_root -wi-ao---- 15.00g /dev/sda3(8575)
lv_tmp vg_root -wi-ao---- 4.00g /dev/sda3(3967)
lv_var vg_root -wi-ao---- 10.00g /dev/sda3(6015)
lvtest vgtest rwi-aor--- 5.00g 1.17 lvtest_rimage_0(0),lvtest_rimage_1(0)
[lvtest_rimage_0] vgtest Iwi-aor--- 5.00g /dev/sde1(1)
[lvtest_rimage_1] vgtest iwi-aor--- 5.00g /dev/sdd1(1)
[lvtest_rmeta_0] vgtest ewi-aor--- 4.00m /dev/sde1(0)
[lvtest_rmeta_1] vgtest ewi-aor--- 4.00m /dev/sdd1(0)
[root@lvm ~]# lvs
WARNING: Not using lvmetad because a repair command was run.
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
lv_home vg_root -wi-ao---- 4.00g
lv_opt vg_root -wi-ao---- <15.50g
lv_root vg_root -wi-ao---- 15.00g
lv_tmp vg_root -wi-ao---- 4.00g
lv_var vg_root -wi-ao---- 10.00g
lvtest vgtest rwi-aor--- 5.00g 16.20
[root@lvm ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_root-lv_root 15G 1.4G 14G 9% /
devtmpfs 908M 0 908M 0% /dev
tmpfs 920M 0 920M 0% /dev/shm
tmpfs 920M 9.0M 911M 1% /run
tmpfs 920M 0 920M 0% /sys/fs/cgroup
/dev/mapper/vg_root-lv_opt 16G 33M 16G 1% /opt
/dev/mapper/vg_root-lv_home 4.0G 33M 4.0G 1% /home
/dev/mapper/vg_root-lv_var 10G 125M 9.9G 2% /var
/dev/mapper/vg_root-lv_tmp 4.0G 33M 4.0G 1% /tmp
/dev/sda1 509M 139M 371M 28% /boot
tmpfs 184M 0 184M 0% /run/user/0
/dev/mapper/vgtest-lvtest 5.0G 33M 5.0G 1% /lvdata [root@lvm ~]# lvs
WARNING: Not using lvmetad because a repair command was run.
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
lv_home vg_root -wi-ao---- 4.00g
lv_opt vg_root -wi-ao---- <15.50g
lv_root vg_root -wi-ao---- 15.00g
lv_tmp vg_root -wi-ao---- 4.00g
lv_var vg_root -wi-ao---- 10.00g
lvtest vgtest rwi-aor--- 5.00g 55.62
[root@lvm ~]# lvdisplay /dev/vgtest/mirror
Failed to find logical volume "vgtest/mirror"
[root@lvm ~]# lvdisplay /dev/vgtest/lvtest
--- Logical volume ---
LV Path /dev/vgtest/lvtest
LV Name lvtest
VG Name vgtest
LV UUID SYCcLe-3RgP-aUj0-Fnef-eODz-cLoK-YtF4iM
LV Write Access read/write
LV Creation host, time lvm, 2018-11-27 15:20:19 +0800
LV Status available
# open 1
LV Size 5.00 GiB
Current LE 1280
Mirrored volumes 2
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:9 [root@lvm ~]#
[root@lvm ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
lv_home vg_root -wi-ao---- 4.00g
lv_opt vg_root -wi-ao---- <15.50g
lv_root vg_root -wi-ao---- 15.00g
lv_tmp vg_root -wi-ao---- 4.00g
lv_var vg_root -wi-ao---- 10.00g
lvtest vgtest rwi-aor--- 5.00g 85.16
[root@lvm ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda3 vg_root lvm2 a-- <48.50g 0
/dev/sdd1 vgtest lvm2 a-- <10.00g 4.99g
/dev/sde1 vgtest lvm2 a-- <10.00g 4.99g
[root@lvm ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
lv_home vg_root -wi-ao---- 4.00g
lv_opt vg_root -wi-ao---- <15.50g
lv_root vg_root -wi-ao---- 15.00g
lv_tmp vg_root -wi-ao---- 4.00g
lv_var vg_root -wi-ao---- 10.00g
lvtest vgtest rwi-aor--- 5.00g 90.04 [root@lvm ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
lv_home vg_root -wi-ao---- 4.00g
lv_opt vg_root -wi-ao---- <15.50g
lv_root vg_root -wi-ao---- 15.00g
lv_tmp vg_root -wi-ao---- 4.00g
lv_var vg_root -wi-ao---- 10.00g
lvtest vgtest rwi-aor--- 5.00g 100.00 [root@lvm ~]# systemctl status lvm2-lvmetad.service
● lvm2-lvmetad.service - LVM2 metadata daemon
Loaded: loaded (/usr/lib/systemd/system/lvm2-lvmetad.service; static; vendor preset: enabled)
Active: active (running) since Wed 2018-11-28 06:36:51 CST; 4ms ago
Docs: man:lvmetad(8)
Main PID: 5124 (systemd)
CGroup: /system.slice/lvm2-lvmetad.service
└─5124 /usr/lib/systemd/systemd --switched-root --system --deserialize 22 Nov 28 06:36:51 lvm systemd[1]: lvm2-lvmetad.service: main process exited, code=killed, status=9/KILL
Nov 28 06:36:51 lvm systemd[1]: Unit lvm2-lvmetad.service entered failed state.
Nov 28 06:36:51 lvm systemd[1]: lvm2-lvmetad.service failed.
Nov 28 06:36:51 lvm systemd[1]: Started LVM2 metadata daemon.
Nov 28 06:36:51 lvm systemd[1]: Starting LVM2 metadata daemon...
[root@lvm ~]# systemctl stop lvm2-lvmetad.service
Warning: Stopping lvm2-lvmetad.service, but it can still be activated by:
lvm2-lvmetad.socket [root@lvm ~]# systemctl restart lvm2-lvmetad.service
[root@lvm ~]# systemctl status lvm2-lvmetad.service
● lvm2-lvmetad.service - LVM2 metadata daemon
Loaded: loaded (/usr/lib/systemd/system/lvm2-lvmetad.service; static; vendor preset: enabled)
Active: active (running) since Wed 2018-11-28 06:37:17 CST; 5s ago
Docs: man:lvmetad(8)
Main PID: 5161 (lvmetad)
CGroup: /system.slice/lvm2-lvmetad.service
└─5161 /usr/sbin/lvmetad -f Nov 28 06:37:17 lvm systemd[1]: Started LVM2 metadata daemon.
Nov 28 06:37:17 lvm systemd[1]: Starting LVM2 metadata daemon...
[root@lvm ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
lv_home vg_root -wi-ao---- 4.00g
lv_opt vg_root -wi-ao---- <15.50g
lv_root vg_root -wi-ao---- 15.00g
lv_tmp vg_root -wi-ao---- 4.00g
lv_var vg_root -wi-ao---- 10.00g
lvtest vgtest rwi-aor--- 5.00g 100.00

  

LVM 镜像硬盘更换、数据恢复(centos7.4 redhat7.5)的更多相关文章

  1. CentOS7 LVM添加硬盘及扩容

    一.LVM简介 LVM是 Logical Volume Manager(逻辑卷管理)的简写,它是Linux环境下对磁盘分区进行管理的一种机制.LVM将一个或多个磁盘分区(PV)虚拟为一个卷组(VG), ...

  2. (转)CentOS7 LVM添加硬盘及扩容

    原文:http://blog.51cto.com/qicheng0211/1620171 9818人阅读   一.LVM简介 LVM是 Logical Volume Manager(逻辑卷管理)的简写 ...

  3. DELL EqualLogic PS存储硬盘故障数据恢复成功案例分享

    DELL EqualLogic PS4000采用虚拟ISCSI SAN阵列,为远程或分支办公室.部门和中小企业存储部署带来企业级功能.智能化.自动化和可靠性.以简化的管理.快速的部署及合理的价格满足了 ...

  4. 分布式存储ceph——(5)ceph osd故障硬盘更换

    正常状态:

  5. RAID磁盘恢复方法之一Winhex镜像硬盘与镜像中恢复数据图文

    winhex镜像硬盘和ghost备份是完全不同的,ghost只能克隆或者镜像分区内正常的数据,删除的数据他是不会克隆的,所以在数据恢复应用中,ghost对我们来讲作用就不大了,而使用winhex备份( ...

  6. Ceph添加、删除osd及故障硬盘更换

    添加或删除osd均在ceph部署节点的cent用户下的ceph目录进行. 1. 添加osd 当前ceph集群中有如下osd,现在准备新添加osd: (1)选择一个osd节点,添加好新的硬盘: (2)显 ...

  7. 分布式存储ceph--osd故障硬盘更换(6)

    正常状态:

  8. Ceph osd故障硬盘更换

    正常状态: 故障状态: 实施更换步骤: (1)关闭ceph集群数据迁移: osd硬盘故障,状态变为down.在经过mod osd down out interval 设定的时间间隔后,ceph将其标记 ...

  9. 分布式存储ceph---ceph osd 故障硬盘更换(6)

    正常状态: 故障状态: 实施更换步骤: 1.关闭ceph集群数据迁移: osd硬盘故障,状态变为down.在经过mod osd down out interval 设定的时间间隔后,ceph将其标记为 ...

随机推荐

  1. 在Eclipse中使用Maven将项目(包括Maven引入的依赖jar文件)打成jar文件

    1.  在项目的pom.xml文件中引入以下配置: <build> <plugins> <plugin> <artifactId>maven-assem ...

  2. luoguP4512 【模板】多项式除法 NTT+多项式求逆+多项式除法

    Code: #include<bits/stdc++.h> #define maxn 300000 #define ll long long #define MOD 998244353 # ...

  3. 路飞学城Python-Day19

    [23.绑定方法与非绑定方法介绍] 再类的内部的定义的函数分为两大类: 1.绑定方法: 绑定到对象的方法:直接用def做的函数属性,类内部定义的函数,如果没有绑定装饰器,就是给对象使用的函数,绑定给谁 ...

  4. centos7安装anaconda之后报错:rpm: /home/wyl/anaconda3/lib/liblzma.so.5: version `XZ_5.1.2alpha' not found (required by /lib64/librpmio.so.3)

    1.报错 参考:https://stackoverflow.com/questions/47633870/rpm-lib64-liblzma-so-5-version-xz-5-1-2alpha-no ...

  5. 电子邮件的三个协议: SMTP、IMAP、POP3

    个人总结: 读完这篇文章需要10分钟 讲解了跟电子邮件有关的三个协议: SMTP(simple message transfer protocol 简单信息传输协议 IMAP (internet me ...

  6. composer install或者update 出错

    composer install或者update  出错Your requirements could not be resolved to an installable set of package ...

  7. HDU 1575 Tr A( 简单矩阵快速幂 )

    链接:传送门 思路:简单矩阵快速幂,算完 A^k 后再求一遍主对角线上的和取个模 /********************************************************** ...

  8. rest-framework框架

    rest-framework框架是Django里面非常重要的框架,但提到rest-framework框架就不得不说两种请求方式,那就是CBV和FBV. FBV(function base views) ...

  9. [学习笔记] CS131 Computer Vision: Foundations and Applications:Lecture 3 线性代数初步

    向量和矩阵 什么是矩阵/向量? Vectors and matrix are just collections of ordered numbers that represent something: ...

  10. VUE:条件渲染和列表渲染

    条件渲染 <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <titl ...