With pvmove achieve online data relocation
This document (000020303) is provided subject to the disclaimer at the end of this document.
Environment
- SUSE Linux Enterprise Server 12
- SUSE Linux Enterprise Server 15
- SUSE Linux Enterprise Server for SAP Applications 12
- SUSE Linux Enterprise Server for SAP Applications 15
Situation
# pvs PV VG Fmt Attr PSize PFree /dev/sdc vg1 lvm2 a-- 8.00m 0 /dev/sdd vg1 lvm2 a-- 8.00m 0 /dev/sde lvm2 --- 30.00m 30.00m # dd if=/dev/zero of=/mnt/img bs=1M count=15 # df -Th /mnt Filesystem Type Size Used Avail Use% Mounted on /dev/mapper/vg1-lv1 ext4 15M 15M 0 100% /mnt # pvdisplay /dev/sd{c,d} |grep PE PE Size 4.00 MiB Total PE 2 Free PE 0 Allocated PE 2 PE Size 4.00 MiB Total PE 2 Free PE 0 Allocated PE 2
Resolution
Scenario 1:
Use 'pvmove' to move physical extents to destination PV
# pvdisplay /dev/sd{c,d} |grep PE PE Size 4.00 MiB Total PE 2 Free PE 0 Allocated PE 2 PE Size 4.00 MiB Total PE 2 Free PE 0 Allocated PE 2 # vgextend vg1 /dev/sde Volume group "vg1" successfully extended # pvmove /dev/sdd /dev/sde /dev/sdd: Moved: 100.00% # pvdisplay /dev/sd{c,d,e} |grep PE PE Size 4.00 MiB Total PE 2 Free PE 0 Allocated PE 2 PE Size 4.00 MiB Total PE 2 Free PE 2 Allocated PE 0 PE Size 4.00 MiB Total PE 7 Free PE 5 Allocated PE 2
Scenario 2:
Use 'pvmove' from one single Physical Volume to multiple different Physical Volumes
# pvdisplay /dev/sdc |grep 'Total PE' Total PE 2 # pvmove /dev/sdc:0 /dev/sdd /dev/sdc: Moved: 100.00% # pvmove /dev/sdc:1 /dev/sde /dev/sdc: Moved: 100.00% # pvdisplay /dev/sd{c,d,e} |grep PE PE Size 4.00 MiB Total PE 2 Free PE 2 Allocated PE 0 PE Size 4.00 MiB Total PE 2 Free PE 1 Allocated PE 1 PE Size 4.00 MiB Total PE 7 Free PE 4 Allocated PE 3
Tips
Large PV capacity for the real environment, pvmove command can take a long time to execute, you may want to run the command in the background to avoid display of progress updates in the foreground.
# pvmove -b /dev/sdX /dev/sdY
The following command reports the progress of the pvmove command as a percentage at ten second intervals.
# pvmove -i5 /dev/sdZ
Cause
Additional Information
# man pvmove EXAMPLES Move all physical extents that are used by simple LVs on the specified PV to free physical extents elsewhere in the VG. pvmove /dev/sdb1 Use a specific destination PV when moving physical extents. pvmove /dev/sdb1 /dev/sdc1 Move extents belonging to a single LV. pvmove -n lvol1 /dev/sdb1 /dev/sdc1 Rather than moving the contents of an entire device, it is possible to move a range of physical extents, for example numbers 1000 to 1999 inclusive on the specified PV. pvmove /dev/sdb1:1000-1999 A range of physical extents to move can be specified as start+length. For example, starting from PE 1000. (Counting starts from 0, so this refers to the 1001st to the 2000th PE inclusive.) pvmove /dev/sdb1:1000+1000 Move a range of physical extents to a specific PV (which must have sufficient free extents). pvmove /dev/sdb1:1000-1999 /dev/sdc1 Move a range of physical extents to specific new extents on a new PV. pvmove /dev/sdb1:1000-1999 /dev/sdc1:0-999 If the source and destination are on the same disk, the anywhere allocation policy is needed. pvmove --alloc anywhere /dev/sdb1:1000-1999 /dev/sdb1:0-999 The part of a specific LV present within in a range of physical extents can also be picked out and moved. pvmove -n lvol1 /dev/sdb1:1000-1999 /dev/sdc1
Disclaimer
This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.
- Document ID:000020303
- Creation Date: 28-Jun-2021
- Modified Date:30-Jun-2021
-
- SUSE Linux Enterprise Server
- SUSE Linux Enterprise Server for SAP Applications
For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com