# pvcreate /dev/loop0 Writing physical volume data to disk "/dev/loop0" Physical volume "/dev/loop0" successfully created # pvcreate /dev/loop1 Writing physical volume data to disk "/dev/loop1" Physical volume "/dev/loop1" successfully createdCreate the volume group:
# vgcreate vgtest /dev/loop0 /dev/loop1 Volume group "vgtest" successfully createdCreate a logical volume on the SSD:
# lvcreate -n lvtest1 -L 64MB vgtest /dev/loop0 Logical volume "lvtest1" createdCreate another logical volume on the hard disk:
# lvcreate -n lvtest2 -L 64MB vgtest /dev/loop1 Logical volume "lvtest2" createdMove logical volume lvtest1 to the hard disk:
# pvmove -n vgtest/lvtest1 /dev/loop0 /dev/loop1 /dev/loop0: Moved: 25.0% /dev/loop0: Moved: 100.0%Move logical volume lvtest2 to the SSD:
# pvmove -n vgtest/lvtest2 /dev/loop1 /dev/loop0 /dev/loop1: Moved: 75.0% /dev/loop1: Moved: 100.0%Check the distribution of the logical volumes among the physical volumes:
# pvdisplay -m /dev/loop{0,1} --- Physical volume --- PV Name /dev/loop0 VG Name vgtest PV Size 128.00 MiB / not usable 4.00 MiB Allocatable yes PE Size 4.00 MiB Total PE 31 Free PE 15 Allocated PE 16 PV UUID hEIiA9-nq60-bCJI-OaPe-jSw3-YOqp-fFcbqY --- Physical Segments --- Physical extent 0 to 15: Logical volume /dev/vgtest/lvtest2 Logical extents 0 to 15 Physical extent 16 to 30: FREE --- Physical volume --- PV Name /dev/loop1 VG Name vgtest PV Size 256.00 MiB / not usable 4.00 MiB Allocatable yes PE Size 4.00 MiB Total PE 63 Free PE 47 Allocated PE 16 PV UUID gtf7QG-Etc5-u2Br-KEHP-LDdN-BhqJ-J9OKQd --- Physical Segments --- Physical extent 0 to 15: FREE Physical extent 16 to 31: Logical volume /dev/vgtest/lvtest1 Logical extents 0 to 15 Physical extent 32 to 62: FREEMove just the first five physical extents of the logical volume lvtest1 to the SSD:
# pvmove -n vgtest/lvtest1 /dev/loop1:16-20 /dev/loop0 /dev/loop1: Moved: 100.0%