Bootstrap FreeKB - LVM (Logical Volume Manager) - Resolve error "insufficient free space" when using the pvmove command
LVM (Logical Volume Manager) - Resolve error "insufficient free space" when using the pvmove command

Updated:   |  LVM (Logical Volume Manager) articles

When using the pvmove to move an LVM physical volume, error insufficient free space is displayed.

[root@server1 ~]# pvmove /dev/sdb1 /dev/md0  
Insufficient free space: 471833 extents needed, but only 471826 available  
Unable to allocate mirror extents for pvmove0.  
Failed to convert pvmove LV to mirrored

 

Use the pvdisplay command to display the physical volumes. Notice in this example, the physical volumes have a different total physical extent (PE) capacity, where /dev/sdb1 has 471833 total PE and /dev/md0 has 471826 total PE. We are unable to move physical volume /dev/sdb1 to /dev/md0, because /dev/sdb1 has more capacity than /dev/md0.

[root@server1 ~]# pvdisplay
--- Physical volume ---
PV Name    /dev/sdb1
PV Size    1.80 TiB / not usable 3.00 MiB
PE Size    4.00 MiB
Total PE   471833

--- Physical volume ---
PV Name    /dev/md0
PV Size    1.80 TiB / not usable 3.00 MiB
PE Size    4.00 MiB
Total PE   471826

 

We can use the pvresize command with the --setphysicalvolumesize option to set the size of the physical volume. By default, the --setphysicalvolumesize uses Megabytes. For example, pvresize --setphysicalvolumesize 10 /dev/sdb1 would set the size of the physical volume to 10 MB.  1 physical extent (PE) is 4 MB. We want /dev/md0 to have 471833 physical extents. 

  • 471,833 x 4 = 1,887,332 MB

In this example, we can resize /dev/md0 to 1,887,332 MB, which will result in 471,833 physical extents.

[root@server1 ~]# pvresize --setphysicalvolumesize 1887332 /dev/md0

 

Using pvdisplay again will show that the Total PE of each physical volume is identical.

[root@server1 ~]# pvdisplay
--- Physical volume ---
PV Name    /dev/sdb1
PV Size    1.80 TiB / not usable 3.00 MiB
PE Size    4.00 MiB
Total PE   471833

--- Physical volume ---
PV Name    /dev/md0
PV Size    1.80 TiB / not usable 3.00 MiB
PE Size    4.00 MiB
Total PE   471833

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter e7ac3a in the box below so that we can be sure you are a human.