总而言之,当前在逻辑卷(myvg-root)中有一个ext4文件系统(root),该逻辑卷位于由两个物理卷(其中一个是新添加的sdb3)组成的卷组(myvg)中。
您可以使用lvdisplay检查逻辑范围到物理范围的映射
$ lvdisplay -m
--- Logical volume ---
LV Name /dev/myvg/root
VG Name pfeifer
LV UUID 2LeFq8-zz3y-Y62m-931D-mD3m-XmK1-6Zp3Ir
LV Write Access read/write
LV Status available
# open 1
LV Size 3.62 TiB
Current LE 947851
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 251:0
--- Segments ---
Logical extent 0 to 470980:
Type linear
Physical volume /dev/sda3
Physical extents 0 to 470980
Logical extent 470981 to 947850:
Type linear
Physical volume /dev/sdb3
Physical extents 0 to 476869
您可以使用lvreduce简单地减小此逻辑卷的大小
$ lvreduce -l -476870 /dev/myvg/root
WARNING: Reducing active and open logical volume to 1.80 TiB
THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce root? [y/n]: y
Reducing logical volume root to 1.80 TiB
Logical volume root successfully resized
请注意,要减少的sdb3上的逻辑扩展区数是476869 + 1(从0开始计数!)。而已。现在,快速检查似乎可以确认原始的世界顺序:
--- Segments ---
Logical extent 0 to 470980:
Type linear
Physical volume /dev/sda3
Physical extents 0 to 470980
现在,缓慢而乏味的pvmove命令应允许将数据移至上方:
nohup pvmove -n /dev/myvg/root /dev/sda3 /dev/sdb3 &