[linux-lvm] create physical partition from logical partition

Marian Csontos mcsontos at redhat.com
Thu Feb 7 13:02:13 UTC 2013


On 02/06/2013 06:10 PM, fakhreddine HABIB wrote:
> Hi,
>
>     I nead please your help to create a physical partition from a logical
> partition.
>
>     I present my problem : I have the configuration (attached pic) of the
> partitions.
>
>     I use the centos system. The problem that my group volume "vg_rega" use
> the whole of the physical disk. I want to install Ubuntu system with centos
> (dual boot), but i need a physical partition to do that. How can'i convert
> the " Unused Space " logical partition to physical partition to install
> Ubuntu.

1st: backup your data! Though operations should be safe, there is always 
human factor and other risks.

Before creating a new partition you will need to resize (shrink) the PV:

     pvresize --pvresize --setphysicalvolumesize DESIRED_PV_SIZE /dev/sda2

pvresize should be safe: it will only shrink PV when there is free space 
at the end, but does not relocate LVs if the free space is in the 
middle. In that case you will need to move the extents first:

     pvmove --alloc anywhere /dev/sda2:OLDSTART-OLDEND /dev/sda2

This may not work correctly and allocate data in the region being moved 
from (which needs to verify with latest version and report)

Then you should be able to shrink the sda2 partition, using parted or 
fdisk. This may be the riskiest part.

However, Ubuntu is able to use Logical Volumes, so you should not need 
to add more physical partitions: for me "dualboot" of 2 linux systems 
with single /boot partition worked mostly fine - except when one is 
using old grub (CentOS) and another grub2 (ubuntu), but even that is not 
impossible...

-- Marian

>
>    Thank you.
>
> F.H
>
>
>
>
> _______________________________________________
> linux-lvm mailing list
> linux-lvm at redhat.com
> https://www.redhat.com/mailman/listinfo/linux-lvm
> read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/




More information about the linux-lvm mailing list