逻辑卷裁剪大小为120M
[root@www ~]# lvreduce -L 120M /dev/storage/vo
WARNING: Reducing active logical volume to 120.00 MiB.
THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce storage/vo? [y/n]: y
Size of logical volume storage/vo changed from 200.00 MiB (50 extents) to 120.00 MiB (30 extents).
Logical volume vo successfully resized.
[root@www ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
vo storage -wi-a----- 120.00m
[root@www ~]#
删除逻辑卷,依次删除lv逻���卷,gv卷组,pv物理卷
[root@www ~]# lvremove /dev/storage/vo
Do you really want to remove active logical volume vo? [y/n]: y
Logical volume "vo" successfully removed
[root@www ~]# lvs
[root@www ~]# vgremove storage
Volume group "storage" successfully removed
[root@www ~]# vgs
[root@www ~]# pvremove /dev/sde
Labels on physical volume "/dev/sde" successfully wiped
[root@www ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sdb lvm2 ---- 1.00g 1.00g
/dev/sdc lvm2 ---- 1.00g 1.00g
/dev/sdd lvm2 ---- 1.00g 1.00g
[root@www ~]# pvremove /dev/sdd /dev/sdc /dev/sdb
Labels on physical volume "/dev/sdd" successfully wiped
Labels on physical volume "/dev/sdc" successfully wiped
Labels on physical volume "/dev/sdb" successfully wiped
[root@www ~]# pvs
数据迁移,首先创建一些文件touch /soft/{00..100}.txt,然后进行数据迁移.
[root@www ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sdb oradata lvm2 a--u 1020.00m 140.00m
/dev/sdc oradata lvm2 a--u 1020.00m 1020.00m
/dev/sdd oradata lvm2 a--u 1020.00m 1020.00m
/dev/sde oradata lvm2 a--u 1020.00m 1020.00m
[root@www ~]# pvmove /dev/sdb /dev/sdd
/dev/sdb: Moved: 0.9%
/dev/sdb: Moved: 36.4%
/dev/sdb: Moved: 54.5%
/dev/sdb: Moved: 100.0%
[root@www ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sdb oradata lvm2 a--u 1020.00m 1020.00m
/dev/sdc oradata lvm2 a--u 1020.00m 1020.00m
/dev/sdd oradata lvm2 a--u 1020.00m 140.00m
/dev/sde oradata lvm2 a--u 1020.00m 1020.00m
[root@www ~]#
迁移后查看文件并没有丢失,最后删除这些文件.
[root@www ~]# ls /soft/
000.txt 010.txt 020.txt 030.txt 040.txt 050.txt 060.txt 070.txt 080.txt 090.txt 100.txt
001.txt 011.txt 021.txt 031.txt 041.txt 051.txt 061.txt 071.txt 081.txt 091.txt
002.txt 012.txt 022.txt 032.txt 042.txt 052.txt 062.txt 072.txt 082.txt 092.txt
003.txt 013.txt 023.txt 033.txt 043.txt 053.txt 063.txt 073.txt 083.txt 093.txt
004.txt 014.txt 024.txt 034.txt 044.txt 054.txt 064.txt 074.txt 084.txt 094.txt
005.txt 015.txt 025.txt 035.txt 045.txt 055.txt 065.txt 075.txt 085.txt 095.txt
006.txt 016.txt 026.txt 036.txt 046.txt 056.txt 066.txt 076.txt 086.txt 096.txt
007.txt 017.txt 027.txt 037.txt 047.txt 057.txt 067.txt 077.txt 087.txt 097.txt
008.txt 018.txt 028.txt 038.txt 048.txt 058.txt 068.txt 078.txt 088.txt 098.txt
009.txt 019.txt 029.txt 039.txt 049.txt 059.txt 069.txt 079.txt 089.txt 099.txt
[root@www ~]# find /soft/ -type f -size 0 -delete
Linux公社的RSS地址:https://www.linuxidc.com/rssFeed.aspx