![pvmove - 将物理范围的子范围从段移动到未分配的 PE 范围](https://linux22.com/image/208764/pvmove%20-%20%E5%B0%86%E7%89%A9%E7%90%86%E8%8C%83%E5%9B%B4%E7%9A%84%E5%AD%90%E8%8C%83%E5%9B%B4%E4%BB%8E%E6%AE%B5%E7%A7%BB%E5%8A%A8%E5%88%B0%E6%9C%AA%E5%88%86%E9%85%8D%E7%9A%84%20PE%20%E8%8C%83%E5%9B%B4.png)
是否可以将物理盘区的子范围从物理卷末尾的段移动到物理卷中间的未分配范围? (子范围具有与未分配范围相同的范围数。)
例如,我想通过将最后一个段的最后 256 个扩展区移动到扩展区 50688-50943,将未分配的扩展区(扩展区 50688-50943)移动到物理卷的末尾:
# pvmove --test --alloc anywhere /dev/mapper/cryptdisk:60694-60949 /dev/mapper/cryptdisk:50688-50943
TEST MODE: Metadata will NOT be updated and volumes will not be (de)activated.
以下是物理卷的盘区信息:
# pvs -v --segments
PV VG Fmt Attr PSize PFree Start SSize LV Start Type PE Ranges
/dev/mapper/cryptdisk lvg lvm2 a-- <238.09g 1.00g 0 3328 root 0 linear /dev/mapper/cryptdisk:0-3327
/dev/mapper/cryptdisk lvg lvm2 a-- <238.09g 1.00g 3328 2560 swap 0 linear /dev/mapper/cryptdisk:3328-5887
/dev/mapper/cryptdisk lvg lvm2 a-- <238.09g 1.00g 5888 43520 home 0 linear /dev/mapper/cryptdisk:5888-49407
/dev/mapper/cryptdisk lvg lvm2 a-- <238.09g 1.00g 49408 1280 root 13334 linear /dev/mapper/cryptdisk:49408-50687
/dev/mapper/cryptdisk lvg lvm2 a-- <238.09g 1.00g 50688 256 0 free
/dev/mapper/cryptdisk lvg lvm2 a-- <238.09g 1.00g 50944 1536 root 11798 linear /dev/mapper/cryptdisk:50944-52479
/dev/mapper/cryptdisk lvg lvm2 a-- <238.09g 1.00g 52480 256 root 11542 linear /dev/mapper/cryptdisk:52480-52735
/dev/mapper/cryptdisk lvg lvm2 a-- <238.09g 1.00g 52736 256 root 11286 linear /dev/mapper/cryptdisk:52736-52991
/dev/mapper/cryptdisk lvg lvm2 a-- <238.09g 1.00g 52992 256 root 11030 linear /dev/mapper/cryptdisk:52992-53247
/dev/mapper/cryptdisk lvg lvm2 a-- <238.09g 1.00g 53248 2560 root 8470 linear /dev/mapper/cryptdisk:53248-55807
/dev/mapper/cryptdisk lvg lvm2 a-- <238.09g 1.00g 55808 1280 root 7190 linear /dev/mapper/cryptdisk:55808-57087
/dev/mapper/cryptdisk lvg lvm2 a-- <238.09g 1.00g 57088 3862 root 3328 linear /dev/mapper/cryptdisk:57088-60949
答案1
您需要将所有已使用的扇区移动到末尾,即第一个空闲扇区:
pvmove --alloc anywhere /dev/mapper/cryptdisk:50944-60949/dev/mapper/cryptdisk:50688-60693