lvconvert
Posted liweiming
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了lvconvert相关的知识,希望对你有一定的参考价值。
Last login: Thu Nov 15 07:10:20 2018 from 192.168.31.220 [[email protected] ~]# 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 [[email protected] ~]# 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
[[email protected] dd_data]# pvs
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
[[email protected] ~]# dd if=/dev/zero of=/dev/sdb1 count=10 10+0 records in 10+0 records out 5120 bytes (5.1 kB) copied, 0.00133574 s, 3.8 MB/s [[email protected] ~]# 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 [[email protected] ~]# lvs 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 [[email protected] ~]# vgs 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 [[email protected] ~]# pvs 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 [[email protected] ~]# fdisk /dev/sd sda sda1 sda2 sda3 sdb sdb1 sdd sdd1 [[email protected] ~]# fdisk /dev/sd^C [[email protected] ~]# echo "- - -" > /sys/class/scsi_host/host0/scan [[email protected] ~]# echo "- - -" > /sys/class/scsi_host/host1/scan [[email protected] ~]# echo "- - -" > /sys/class/scsi_host/host2/scan [[email protected] ~]# 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 [[email protected] ~]# 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 [[email protected] ~]# fdisk /dev/sdc 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 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 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. [[email protected] ~]# 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 [[email protected] ~]# pvcreate /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. Physical volume "/dev/sdc1" successfully created [[email protected] ~]# pvs 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 [[email protected] ~]# 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 [[email protected] ~]# lvs -a -o +devices 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) [[email protected] ~]# cd /dd_data/ [[email protected] dd_data]# ls liweiming lost+found [[email protected] dd_data]# touch test [[email protected] dd_data]# vgreduce --removemissing --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 [[email protected] dd_data]# vgs VG #PV #LV #SN Attr VSize VFree vg 1 1 0 wz--n- 9.99g 3.99g [[email protected] 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 [[email protected] dd_data]# vgextend vg /dev/sdc1 Volume group "vg" successfully extended [[email protected] 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 [[email protected] dd_data]# vgs VG #PV #LV #SN Attr VSize VFree vg 2 1 0 wz--n- 19.98g 13.98g [[email protected] dd_data]# lvconvert -m1 /dev/vg vg/ vga_arbiter [[email protected] dd_data]# lvconvert -m1 /dev/mapper/vg-lv /dev/sdd1 /dev/sdc1 Can‘t find LV vg-lv in VG vg [[email protected] dd_data]# lvs LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert lv vg -wi-ao---- 6.00g [[email protected] dd_data]# lvconvert -m1 /dev/mapper/vg-lv liweiming lost+found/ test [[email protected] 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% [[email protected] 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) [[email protected] 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 [[email protected] 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 [[email protected] dd_data]# vgs VG #PV #LV #SN Attr VSize VFree vg 2 1 0 wz--n- 19.98g 7.98g [[email protected] 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 [[email protected] dd_data]# ls liweiming lost+found test [[email protected] dd_data]#
以上是关于lvconvert的主要内容,如果未能解决你的问题,请参考以下文章