当前位置:   article > 正文

LVM 镜像硬盘更换、数据恢复(centos7.4 redhat7.5)

centos vgextend 报错 while checking userd and assumed devices
 
案例说明
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

在线添加新硬盘

 

  1. [root@web02 ~]# fdisk /dev/sd
  2. sda sda1 sda2 sda3 sdb sdb1 sdd sdd1
  3. [root@web02 ~]# fdisk /dev/sd^C
  4. [root@web02 ~]# echo "- - -" > /sys/class/scsi_host/host0/scan ###刷新硬盘
  5. [root@web02 ~]# echo "- - -" > /sys/class/scsi_host/host1/scan
  6. [root@web02 ~]# echo "- - -" > /sys/class/scsi_host/host2/scan
  7. [root@web02 ~]# lsblk
  8. NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
  9. sr0 11:0 1 1024M 0 rom
  10. sda 8:0 0 50G 0 disk
  11. ├─sda1 8:1 0 1G 0 part /boot
  12. ├─sda2 8:2 0 47.5G 0 part /
  13. └─sda3 8:3 0 1.5G 0 part [SWAP]
  14. sdb 8:16 0 10G 0 disk
  15. └─sdb1 8:17 0 10G 0 part
  16. └─vg-lv_mimage_0 (dm-1) 253:1 0 6G 0 lvm
  17. └─vg-lv (dm-3) 253:3 0 6G 0 lvm /dd_data
  18. sdd 8:48 0 10G 0 disk
  19. └─sdd1 8:49 0 10G 0 part
  20. ├─vg-lv_mlog (dm-0) 253:0 0 4M 0 lvm
  21. │ └─vg-lv (dm-3) 253:3 0 6G 0 lvm /dd_data
  22. └─vg-lv_mimage_1 (dm-2) 253:2 0 6G 0 lvm
  23. └─vg-lv (dm-3) 253:3 0 6G 0 lvm /dd_data
  24. sdc 8:32 0 10G 0 disk ###新添加的硬盘
  25. [root@web02 ~]# fdisk -l /dev/sdc ###查看核实新硬盘信息
  26. Disk /dev/sdc: 10.7 GB, 10737418240 bytes
  27. 255 heads, 63 sectors/track, 1305 cylinders
  28. Units = cylinders of 16065 * 512 = 8225280 bytes
  29. Sector size (logical/physical): 512 bytes / 512 bytes
  30. I/O size (minimum/optimal): 512 bytes / 512 bytes
  31. Disk identifier: 0x00000000
  32. [root@web02 ~]# fdisk /dev/sdc ###对新硬盘分区,做成lvm格式
  33. Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
  34. Building a new DOS disklabel with disk identifier 0xc9fa05fb.
  35. Changes will remain in memory only, until you decide to write them.
  36. After that, of course, the previous content won't be recoverable.
  37. Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
  38. WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
  39. switch off the mode (command 'c') and change display units to
  40. sectors (command 'u').
  41. Command (m for help): n ###新建分区
  42. Command action
  43. e extended
  44. p primary partition (1-4)
  45. p ### 主分区
  46. Partition number (1-4): 1 ###设置为1分区
  47. First cylinder (1-1305, default 1):
  48. Using default value 1
  49. Last cylinder, +cylinders or +size{K,M,G} (1-1305, default 1305):
  50. Using default value 1305
  51. Command (m for help): t ###分区类型
  52. Selected partition 1
  53. Hex code (type L to list codes): 8e lvm格式分区
  54. Changed system type of partition 1 to 8e (Linux LVM)
  55. Command (m for help): p ###打印分区信息
  56. Disk /dev/sdc: 10.7 GB, 10737418240 bytes
  57. 255 heads, 63 sectors/track, 1305 cylinders
  58. Units = cylinders of 16065 * 512 = 8225280 bytes
  59. Sector size (logical/physical): 512 bytes / 512 bytes
  60. I/O size (minimum/optimal): 512 bytes / 512 bytes
  61. Disk identifier: 0xc9fa05fb
  62. Device Boot Start End Blocks Id System
  63. /dev/sdc1 1 1305 10482381 8e Linux LVM
  64. Command (m for help): w ###写入分区信息
  65. The partition table has been altered!
  66. Calling ioctl() to re-read partition table.
  67. Syncing disks.
  68. [root@web02 ~]# lsblk ###查看新硬盘分区
  69. NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
  70. sr0 11:0 1 1024M 0 rom
  71. sda 8:0 0 50G 0 disk
  72. ├─sda1 8:1 0 1G 0 part /boot
  73. ├─sda2 8:2 0 47.5G 0 part /
  74. └─sda3 8:3 0 1.5G 0 part [SWAP]
  75. sdb 8:16 0 10G 0 disk
  76. └─sdb1 8:17 0 10G 0 part
  77. └─vg-lv_mimage_0 (dm-1) 253:1 0 6G 0 lvm
  78. └─vg-lv (dm-3) 253:3 0 6G 0 lvm /dd_data
  79. sdd 8:48 0 10G 0 disk
  80. └─sdd1 8:49 0 10G 0 part
  81. ├─vg-lv_mlog (dm-0) 253:0 0 4M 0 lvm
  82. │ └─vg-lv (dm-3) 253:3 0 6G 0 lvm /dd_data
  83. └─vg-lv_mimage_1 (dm-2) 253:2 0 6G 0 lvm
  84. └─vg-lv (dm-3) 253:3 0 6G 0 lvm /dd_data
  85. sdc 8:32 0 10G 0 disk
  86. └─sdc1 8:33 0 10G 0 part
  87. [root@web02 ~]# lvs -a -o +devices ###查看lv的激活信息状态
  88. Couldn't find device with uuid XvYP09-jmxl-A6Pl-ViMz-t0k8-AwWd-5IUbWv.
  89. Couldn't find device for segment belonging to vg/lv_mimage_0 while checking used and assumed devices.
  90. LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert Devices
  91. lv vg mwi-aom-p- 6.00g [lv_mlog] 100.00 lv_mimage_0(0),lv_mimage_1(0)
  92. [lv_mimage_0] vg iwi-aom-p- 6.00g unknown device(0)
  93. [lv_mimage_1] vg iwi-aom--- 6.00g /dev/sdd1(0)
  94. [lv_mlog] vg lwi-aom--- 4.00m /dev/sdd1(1536)
  95. [root@web02 ~]# pvcreate /dev/sdc1 ###把 /dev/sdc1 创建成pv
  96. Couldn't find device with uuid XvYP09-jmxl-A6Pl-ViMz-t0k8-AwWd-5IUbWv.
  97. Couldn't find device for segment belonging to vg/lv_mimage_0 while checking used and assumed devices.
  98. Physical volume "/dev/sdc1" successfully created
  99. [root@web02 ~]# pvs ###查看pv /dev/sdc1
  100. Couldn't find device with uuid XvYP09-jmxl-A6Pl-ViMz-t0k8-AwWd-5IUbWv.
  101. Couldn't find device for segment belonging to vg/lv_mimage_0 while checking used and assumed devices.
  102. PV VG Fmt Attr PSize PFree
  103. /dev/sdc1 lvm2 ---- 10.00g 10.00g
  104. /dev/sdd1 vg lvm2 a--u 9.99g 3.99g
  105. 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)

 

 

 

 

  1. [BEGIN] 2018/11/27 22:23:20
  2. Connection established.
  3. To escape to local shell, press Ctrl+Alt+].
  4. Last login: Tue Nov 27 16:02:26 2018 from 172-5-0-243.lightspeed.oshkwi.sbcglobal.net
  5. [root@lvm ~]#
  6. [root@lvm ~]# lvs -a -o name,copy_percent,devices vgtest
  7. LV Cpy%Sync Devices
  8. lvtest 100.00 lvtest_rimage_0(0),lvtest_rimage_1(0)
  9. [lvtest_rimage_0]
  10. [lvtest_rimage_1] /dev/sdd1(1)
  11. [lvtest_rmeta_0]
  12. [lvtest_rmeta_1] /dev/sdd1(0)
  13. [root@lvm ~]# lvs -a -o +devices
  14. LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert Devices
  15. lv_home vg_root -wi-ao---- 4.00g /dev/sda3(4991)
  16. lv_opt vg_root -wi-ao---- <15.50g /dev/sda3(0)
  17. lv_root vg_root -wi-ao---- 15.00g /dev/sda3(8575)
  18. lv_tmp vg_root -wi-ao---- 4.00g /dev/sda3(3967)
  19. lv_var vg_root -wi-ao---- 10.00g /dev/sda3(6015)
  20. lvtest vgtest rwi-aor-r- 5.00g 100.00 lvtest_rimage_0(0),lvtest_rimage_1(0)
  21. [lvtest_rimage_0] vgtest vwi-aor-r- 5.00g
  22. [lvtest_rimage_1] vgtest iwi-aor--- 5.00g /dev/sdd1(1)
  23. [lvtest_rmeta_0] vgtest ewi-aor-r- 4.00m
  24. [lvtest_rmeta_1] vgtest ewi-aor--- 4.00m /dev/sdd1(0)
  25. [root@lvm ~]# pvs
  26. PV VG Fmt Attr PSize PFree
  27. /dev/sda3 vg_root lvm2 a-- <48.50g 0
  28. /dev/sdd1 vgtest lvm2 a-- <10.00g 4.99g
  29. /dev/sde1 vgtest lvm2 a-- <10.00g <10.00g
  30. [root@lvm ~]# vgs
  31. VG #PV #LV #SN Attr VSize VFree
  32. vg_root 1 5 0 wz--n- <48.50g 0
  33. vgtest 2 1 0 wz--n- 19.99g <14.99g
  34. [root@lvm ~]# lvs
  35. LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
  36. lv_home vg_root -wi-ao---- 4.00g
  37. lv_opt vg_root -wi-ao---- <15.50g
  38. lv_root vg_root -wi-ao---- 15.00g
  39. lv_tmp vg_root -wi-ao---- 4.00g
  40. lv_var vg_root -wi-ao---- 10.00g
  41. lvtest vgtest rwi-aor-r- 5.00g 100.00
  42. [root@lvm ~]# lvconvert -m1 /dev/vgtest/lvtest /dev/sdd1 /dev/sde1
  43. Are you sure you want to convert raid1 LV vgtest/lvtest to 2 images enhancing resilience? [y/n]: y
  44. WARNING: vgtest/lvtest already has image count of 2.
  45. Logical volume vgtest/lvtest successfully converted.
  46. [root@lvm ~]# lvs -a -o +devices
  47. LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert Devices
  48. lv_home vg_root -wi-ao---- 4.00g /dev/sda3(4991)
  49. lv_opt vg_root -wi-ao---- <15.50g /dev/sda3(0)
  50. lv_root vg_root -wi-ao---- 15.00g /dev/sda3(8575)
  51. lv_tmp vg_root -wi-ao---- 4.00g /dev/sda3(3967)
  52. lv_var vg_root -wi-ao---- 10.00g /dev/sda3(6015)
  53. lvtest vgtest rwi-aor-r- 5.00g 100.00 lvtest_rimage_0(0),lvtest_rimage_1(0)
  54. [lvtest_rimage_0] vgtest vwi-aor-r- 5.00g
  55. [lvtest_rimage_1] vgtest iwi-aor--- 5.00g /dev/sdd1(1)
  56. [lvtest_rmeta_0] vgtest ewi-aor-r- 4.00m
  57. [lvtest_rmeta_1] vgtest ewi-aor--- 4.00m /dev/sdd1(0)
  58. [root@lvm ~]# lvconvert --repair /dev/mapper/vgtest-lvtest
  59. WARNING: Disabling lvmetad cache for repair command.
  60. WARNING: Not using lvmetad because of repair.
  61. Attempt to replace failed RAID images (requires full device resync)? [y/n]: y
  62. Faulty devices in vgtest/lvtest successfully replaced.
  63. [root@lvm ~]# lvs -a -o +devices
  64. WARNING: Not using lvmetad because a repair command was run.
  65. LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert Devices
  66. lv_home vg_root -wi-ao---- 4.00g /dev/sda3(4991)
  67. lv_opt vg_root -wi-ao---- <15.50g /dev/sda3(0)
  68. lv_root vg_root -wi-ao---- 15.00g /dev/sda3(8575)
  69. lv_tmp vg_root -wi-ao---- 4.00g /dev/sda3(3967)
  70. lv_var vg_root -wi-ao---- 10.00g /dev/sda3(6015)
  71. lvtest vgtest rwi-aor--- 5.00g 1.17 lvtest_rimage_0(0),lvtest_rimage_1(0)
  72. [lvtest_rimage_0] vgtest Iwi-aor--- 5.00g /dev/sde1(1)
  73. [lvtest_rimage_1] vgtest iwi-aor--- 5.00g /dev/sdd1(1)
  74. [lvtest_rmeta_0] vgtest ewi-aor--- 4.00m /dev/sde1(0)
  75. [lvtest_rmeta_1] vgtest ewi-aor--- 4.00m /dev/sdd1(0)
  76. [root@lvm ~]# lvs
  77. WARNING: Not using lvmetad because a repair command was run.
  78. LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
  79. lv_home vg_root -wi-ao---- 4.00g
  80. lv_opt vg_root -wi-ao---- <15.50g
  81. lv_root vg_root -wi-ao---- 15.00g
  82. lv_tmp vg_root -wi-ao---- 4.00g
  83. lv_var vg_root -wi-ao---- 10.00g
  84. lvtest vgtest rwi-aor--- 5.00g 16.20
  85. [root@lvm ~]# df -h
  86. Filesystem Size Used Avail Use% Mounted on
  87. /dev/mapper/vg_root-lv_root 15G 1.4G 14G 9% /
  88. devtmpfs 908M 0 908M 0% /dev
  89. tmpfs 920M 0 920M 0% /dev/shm
  90. tmpfs 920M 9.0M 911M 1% /run
  91. tmpfs 920M 0 920M 0% /sys/fs/cgroup
  92. /dev/mapper/vg_root-lv_opt 16G 33M 16G 1% /opt
  93. /dev/mapper/vg_root-lv_home 4.0G 33M 4.0G 1% /home
  94. /dev/mapper/vg_root-lv_var 10G 125M 9.9G 2% /var
  95. /dev/mapper/vg_root-lv_tmp 4.0G 33M 4.0G 1% /tmp
  96. /dev/sda1 509M 139M 371M 28% /boot
  97. tmpfs 184M 0 184M 0% /run/user/0
  98. /dev/mapper/vgtest-lvtest 5.0G 33M 5.0G 1% /lvdata
  99. [root@lvm ~]# lvs
  100. WARNING: Not using lvmetad because a repair command was run.
  101. LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
  102. lv_home vg_root -wi-ao---- 4.00g
  103. lv_opt vg_root -wi-ao---- <15.50g
  104. lv_root vg_root -wi-ao---- 15.00g
  105. lv_tmp vg_root -wi-ao---- 4.00g
  106. lv_var vg_root -wi-ao---- 10.00g
  107. lvtest vgtest rwi-aor--- 5.00g 55.62
  108. [root@lvm ~]# lvdisplay /dev/vgtest/mirror
  109. Failed to find logical volume "vgtest/mirror"
  110. [root@lvm ~]# lvdisplay /dev/vgtest/lvtest
  111. --- Logical volume ---
  112. LV Path /dev/vgtest/lvtest
  113. LV Name lvtest
  114. VG Name vgtest
  115. LV UUID SYCcLe-3RgP-aUj0-Fnef-eODz-cLoK-YtF4iM
  116. LV Write Access read/write
  117. LV Creation host, time lvm, 2018-11-27 15:20:19 +0800
  118. LV Status available
  119. # open 1
  120. LV Size 5.00 GiB
  121. Current LE 1280
  122. Mirrored volumes 2
  123. Segments 1
  124. Allocation inherit
  125. Read ahead sectors auto
  126. - currently set to 8192
  127. Block device 253:9
  128. [root@lvm ~]#
  129. [root@lvm ~]# lvs
  130. LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
  131. lv_home vg_root -wi-ao---- 4.00g
  132. lv_opt vg_root -wi-ao---- <15.50g
  133. lv_root vg_root -wi-ao---- 15.00g
  134. lv_tmp vg_root -wi-ao---- 4.00g
  135. lv_var vg_root -wi-ao---- 10.00g
  136. lvtest vgtest rwi-aor--- 5.00g 85.16
  137. [root@lvm ~]# pvs
  138. PV VG Fmt Attr PSize PFree
  139. /dev/sda3 vg_root lvm2 a-- <48.50g 0
  140. /dev/sdd1 vgtest lvm2 a-- <10.00g 4.99g
  141. /dev/sde1 vgtest lvm2 a-- <10.00g 4.99g
  142. [root@lvm ~]# lvs
  143. LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
  144. lv_home vg_root -wi-ao---- 4.00g
  145. lv_opt vg_root -wi-ao---- <15.50g
  146. lv_root vg_root -wi-ao---- 15.00g
  147. lv_tmp vg_root -wi-ao---- 4.00g
  148. lv_var vg_root -wi-ao---- 10.00g
  149. lvtest vgtest rwi-aor--- 5.00g 90.04
  150. [root@lvm ~]# lvs
  151. LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
  152. lv_home vg_root -wi-ao---- 4.00g
  153. lv_opt vg_root -wi-ao---- <15.50g
  154. lv_root vg_root -wi-ao---- 15.00g
  155. lv_tmp vg_root -wi-ao---- 4.00g
  156. lv_var vg_root -wi-ao---- 10.00g
  157. lvtest vgtest rwi-aor--- 5.00g 100.00
  158. [root@lvm ~]# systemctl status lvm2-lvmetad.service
  159. ● lvm2-lvmetad.service - LVM2 metadata daemon
  160. Loaded: loaded (/usr/lib/systemd/system/lvm2-lvmetad.service; static; vendor preset: enabled)
  161. Active: active (running) since Wed 2018-11-28 06:36:51 CST; 4ms ago
  162. Docs: man:lvmetad(8)
  163. Main PID: 5124 (systemd)
  164. CGroup: /system.slice/lvm2-lvmetad.service
  165. └─5124 /usr/lib/systemd/systemd --switched-root --system --deserialize 22
  166. Nov 28 06:36:51 lvm systemd[1]: lvm2-lvmetad.service: main process exited, code=killed, status=9/KILL
  167. Nov 28 06:36:51 lvm systemd[1]: Unit lvm2-lvmetad.service entered failed state.
  168. Nov 28 06:36:51 lvm systemd[1]: lvm2-lvmetad.service failed.
  169. Nov 28 06:36:51 lvm systemd[1]: Started LVM2 metadata daemon.
  170. Nov 28 06:36:51 lvm systemd[1]: Starting LVM2 metadata daemon...
  171. [root@lvm ~]# systemctl stop lvm2-lvmetad.service
  172. Warning: Stopping lvm2-lvmetad.service, but it can still be activated by:
  173. lvm2-lvmetad.socket
  174. [root@lvm ~]# systemctl restart lvm2-lvmetad.service
  175. [root@lvm ~]# systemctl status lvm2-lvmetad.service
  176. ● lvm2-lvmetad.service - LVM2 metadata daemon
  177. Loaded: loaded (/usr/lib/systemd/system/lvm2-lvmetad.service; static; vendor preset: enabled)
  178. Active: active (running) since Wed 2018-11-28 06:37:17 CST; 5s ago
  179. Docs: man:lvmetad(8)
  180. Main PID: 5161 (lvmetad)
  181. CGroup: /system.slice/lvm2-lvmetad.service
  182. └─5161 /usr/sbin/lvmetad -f
  183. Nov 28 06:37:17 lvm systemd[1]: Started LVM2 metadata daemon.
  184. Nov 28 06:37:17 lvm systemd[1]: Starting LVM2 metadata daemon...
  185. [root@lvm ~]# lvs
  186. LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
  187. lv_home vg_root -wi-ao---- 4.00g
  188. lv_opt vg_root -wi-ao---- <15.50g
  189. lv_root vg_root -wi-ao---- 15.00g
  190. lv_tmp vg_root -wi-ao---- 4.00g
  191. lv_var vg_root -wi-ao---- 10.00g
  192. lvtest vgtest rwi-aor--- 5.00g 100.00

  

转载于:https://www.cnblogs.com/liweiming/p/9964881.html

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/IT小白/article/detail/674593
推荐阅读
相关标签
  

闽ICP备14008679号