Discussion:
[linux-lvm] Changing from standard partition to LVM partition without reinstalling
Amjad Syed
2017-03-03 09:51:11 UTC
Permalink
Hello,

We are using RHEL 7.2 servers to create two node Active/Passive High
available system with shared storage (SAN). We are using pacemaker.

The existing Partition on HDD of Server is of standard type and we would
like to move it to LVM type as we have just two nodes and we are not going
to use clvm.

The current partition on HDD is as follows
/ -> 50 GB
swap -> 25 GB
/u01 -> 200GB

What is the best way to change the partition type to LVM without
reinstallation?
James Hawtin
2017-03-03 17:49:10 UTC
Permalink
Post by Amjad Syed
Hello,
We are using RHEL 7.2 servers to create two node Active/Passive
High available system with shared storage (SAN). We are using pacemaker.
The existing Partition on HDD of Server is of standard type and we
would like to move it to LVM type as we have just two nodes and we are
not going to use clvm.
The current partition on HDD is as follows
/ -> 50 GB
swap -> 25 GB
/u01 -> 200GB
What is the best way to change the partition type to LVM without
reinstallation?
Its possible but its quite difficult to do as you don't have a seperate
/boot partion. I don't know if RHEL 7.2 has an LVM aware grub. Moving it
to LVM would require a new initrd which can cause lots of problems. If I
was doing it I would use tar or dump to copy the information off the
disk. Repartition it with LVM with a physical partiton for /boot, do
some fiddling with a boot disk to sort the boot out then it done. That
is alot of work for very little gain IMHO, so I would question why you
want to convert this to LVM are you looking to reclaim space from / to
use elseware? Is you swap space far to big and you with to use that space?

Personally I would add a temporary new disk to the system create an LVM
PV on that create a VG/LV for /u01 and format it and copy the data from
/u01. The I would delete the existing swap and /u01 partitions. Create a
new partition using all the free space on the old disk as and LVM PV,
add it to the VG, the use pvmove to move the data back from the tempory
disk back to the main one. If I wished to steal some space from / I
would create a filesystem based swap file on / or just create a smaller
swap from the lvm. This all has the advantage that you don't have to fix
the boot, saving a lot of effort, and redoing an initrd from a boot disc
is not something to be done by the inexperienced. However this would
just require making new filesystems and copying data.

James
Brian J. Murrell
2017-03-03 18:46:32 UTC
Permalink
Post by James Hawtin
Post by Amjad Syed
Hello,
We are using  RHEL  7.2 servers to create two node  Active/Passive 
 High available system with shared storage (SAN). We are using
pacemaker.
The existing  Partition on HDD of  Server is of standard type
and  we 
would like to move it to LVM type as we have just two nodes and we
are 
not going to use clvm.
The current partition on HDD is as follows
/   ->  50 GB
swap -> 25 GB
/u01 -> 200GB
What is the best way to change the partition type to LVM without 
reinstallation?
Its possible but its quite difficult
It's not really that difficult, if he understands the mechanics of
partitioning and resizing filesystems. He does need to have 200GB of
free, unpartitioned space on his HDD to create a new partition to be
his new PV.

Or rather he needs as least as much free space in /u01 as he has
consumed space in which case he can shrink the /u01 filesystem and
partition and create a new partition to be his PV.
Post by James Hawtin
to do as you don't have a seperate 
/boot partion.
The / partition can become his /boot once he has evacuated it and
shrunk it.

As long as there is some usable amount of free space on the disk (in
existing partitions or otherwise) this is all just a shell game of
partitions and data, creating new partitions, resizing or deleting old,
moving data around, etc.

It all has to be done from some kind of live boot media though as you
don't really want to be moving live data around.

And really, I will refrain from describing the exact steps in this
partition partition shell game as (a) I don't want to miss any and mess
up his system and (b) if he cannot really come up with the procedure
himself, he really shouldn't be carrying it out.
Post by James Hawtin
If I 
was doing it I would use tar or dump to copy the information off the 
disk.
And yes, if he can't really come up with the recipe to do the partition
shell-game, this is what he should do.

Cheers,
b.

Loading...