码迷,mamicode.com
首页 > 其他好文 > 详细

lvconvert

时间:2018-11-15 18:36:53      阅读:404      评论:0      收藏:0      [点我收藏+]

标签:linu   vco   count   pen   pat   touch   Nging   lsblk   last   

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 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


[root@web02
~]# 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 [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 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 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 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 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. [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 ~]# 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 [root@web02 ~]# 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 [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 ~]# 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) [root@web02 ~]# cd /dd_data/ [root@web02 dd_data]# ls liweiming lost+found [root@web02 dd_data]# touch test [root@web02 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 [root@web02 dd_data]# vgs VG #PV #LV #SN Attr VSize VFree vg 1 1 0 wz--n- 9.99g 3.99g [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 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]# lvconvert -m1 /dev/vg vg/ vga_arbiter [root@web02 dd_data]# lvconvert -m1 /dev/mapper/vg-lv /dev/sdd1 /dev/sdc1 Can‘t find LV vg-lv in VG vg [root@web02 dd_data]# lvs LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert lv vg -wi-ao---- 6.00g [root@web02 dd_data]# lvconvert -m1 /dev/mapper/vg-lv liweiming lost+found/ test [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]# ls liweiming lost+found test [root@web02 dd_data]#

 

lvconvert

标签:linu   vco   count   pen   pat   touch   Nging   lsblk   last   

原文地址:https://www.cnblogs.com/liweiming/p/9964881.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!