linux-lvm.redhat.com archive mirror
 help / color / mirror / Atom feed
* [linux-lvm] lvm2 conf on boot disk
@ 2014-07-08  9:56 Alfredo De Luca
  2014-07-09 16:46 ` Jack Waterworth
  0 siblings, 1 reply; 4+ messages in thread
From: Alfredo De Luca @ 2014-07-08  9:56 UTC (permalink / raw)
  To: linux-lvm

Hi all.
I have red hat 5.7 with no lvm2 installed. Now I want to configure
lvm2 on the root and swap partition then later on adding a couple of
LUNs to create a VG
What's the best practice/procedure to install lvm2 on the boot disk?
Is it possible? I guess I have to run Linux CD in rescue mode

Regards


-- 
Alfredo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [linux-lvm] lvm2 conf on boot disk
  2014-07-08  9:56 [linux-lvm] lvm2 conf on boot disk Alfredo De Luca
@ 2014-07-09 16:46 ` Jack Waterworth
  2014-07-11 12:54   ` Alfredo De Luca
  0 siblings, 1 reply; 4+ messages in thread
From: Jack Waterworth @ 2014-07-09 16:46 UTC (permalink / raw)
  To: linux-lvm

There is no way to do an in-place convert from a partitioned device to 
LVM without losing data. I would recommend adding a new disk, reinstall 
the OS on the new disk with LVM, and then moving over any data that was 
required after installation.

You may be able to do this in rescue mode within a chrooted environment, 
but things could get messy. Add the new device, build the lvm stack, 
copy over the data then chroot into the NEW lvm root. Mount everything 
appropriately, recreate the initrd and re-install grub onto the new 
disk.  Go in with the expectation that you may be fixing things after 
the reboot from rescue mode.

   Jack Waterworth, RHCE
   Senior Technical Support Engineer
   Red Hat Global Support Services
   919.610.2024 -- jack@redhat.com

On 07/08/2014 05:56 AM, Alfredo De Luca wrote:
> Hi all.
> I have red hat 5.7 with no lvm2 installed. Now I want to configure
> lvm2 on the root and swap partition then later on adding a couple of
> LUNs to create a VG
> What's the best practice/procedure to install lvm2 on the boot disk?
> Is it possible? I guess I have to run Linux CD in rescue mode
>
> Regards
>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [linux-lvm] lvm2 conf on boot disk
  2014-07-09 16:46 ` Jack Waterworth
@ 2014-07-11 12:54   ` Alfredo De Luca
  2014-07-11 23:15     ` Jack Waterworth
  0 siblings, 1 reply; 4+ messages in thread
From: Alfredo De Luca @ 2014-07-11 12:54 UTC (permalink / raw)
  To: LVM general discussion and development

[-- Attachment #1: Type: text/plain, Size: 1721 bytes --]

Hi Jack.
Thanks for that. I did pretty much what you said but not sure how to
re-create the initrd then install the grub.
Do you have a specific procedure?
I followed the procedure in attachment but it's slightly different
from what I am looking for.


On Thu, Jul 10, 2014 at 2:46 AM, Jack Waterworth <jack@redhat.com> wrote:
> There is no way to do an in-place convert from a partitioned device to LVM
> without losing data. I would recommend adding a new disk, reinstall the OS
> on the new disk with LVM, and then moving over any data that was required
> after installation.
>
> You may be able to do this in rescue mode within a chrooted environment, but
> things could get messy. Add the new device, build the lvm stack, copy over
> the data then chroot into the NEW lvm root. Mount everything appropriately,
> recreate the initrd and re-install grub onto the new disk.  Go in with the
> expectation that you may be fixing things after the reboot from rescue mode.
>
>   Jack Waterworth, RHCE
>   Senior Technical Support Engineer
>   Red Hat Global Support Services
>   919.610.2024 -- jack@redhat.com
>
> On 07/08/2014 05:56 AM, Alfredo De Luca wrote:
>>
>> Hi all.
>> I have red hat 5.7 with no lvm2 installed. Now I want to configure
>> lvm2 on the root and swap partition then later on adding a couple of
>> LUNs to create a VG
>> What's the best practice/procedure to install lvm2 on the boot disk?
>> Is it possible? I guess I have to run Linux CD in rescue mode
>>
>> Regards
>>
>>
>
> _______________________________________________
> linux-lvm mailing list
> linux-lvm@redhat.com
> https://www.redhat.com/mailman/listinfo/linux-lvm
> read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/



-- 
Alfredo

[-- Attachment #2: lvm --]
[-- Type: application/octet-stream, Size: 1435 bytes --]

A.) First Create an LVM partition:

# pvcreate /dev/sdb1  ---->>> or the any other device as per your server.
# vgcreate vg_new_root  /dev/sdb1
# lvcreate -L 4G -n lv0 vg_new_root
 

B.) Format this new LVM partition with ext3 or ext4 (or as needed):

# mke2fs -j /dev/vg_new_root/lv0
 

C.) Create a new mount point and then mount the LVM Partiton on it:

# mkdir /mnt/NEW_ROOT_PARTITION
# mount /dev/vg_new_root/lv0  /mnt/NEW_ROOT_PARTITION


D.) Copy all contents of "/" to the newly mounted folder:

# tar -cvpf - --one-file-system --acls --xattrs --selinux / | tar -C /mnt/NEW_ROOT_PARTITION -xf
# cp -aux /dev /mnt/NEW_ROOT_PARTITION


E.) Now edit the file -- "/mnt/NEW_ROOT_PARTITION/etc/fstab" to reflect the new root:

/dev/vg_new_root/lv0            /                       ext3    defaults        1 1

 

F.) Now it is needed to chroot to new filesystem and create initrd with raid and lvm support:

# mount --bind /dev  /mnt/NEW_ROOT_PARTITION
# chroot /mnt/NEW_ROOT_PARTITION
# mount -t proc /proc /proc
# mount -t sysfs /sys /sys

# vgscan
# vgchange -ay
# mkinitrd -v /boot/initrd-`uname -r`.lvm.img `uname -r`
   
# umount /sys
# umount /proc
# exit
# mv /mnt/lv0/boot/initrd-`uname -r`.lvm.img /boot


G.) Edit "/boot/grub/grub.conf" to point to new root "/dev/vg_new_root/lv0". Backup the old initrd in "/boot" directory and rename the new initrd to the existing one or edit the entry in grub.conf.

 

H.) Reboot



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [linux-lvm] lvm2 conf on boot disk
  2014-07-11 12:54   ` Alfredo De Luca
@ 2014-07-11 23:15     ` Jack Waterworth
  0 siblings, 0 replies; 4+ messages in thread
From: Jack Waterworth @ 2014-07-11 23:15 UTC (permalink / raw)
  To: linux-lvm

[-- Attachment #1: Type: text/plain, Size: 2459 bytes --]

The rebuild of the ramdisk should use the 'mkinitrd' command:

     # mkinitrd /boot/initrd-<version>.img <version>

grub install would be either 'grub' or 'grub-install'.

     # grub-install /dev/sda

If you have an active Red Hat subscription both procedures should be 
documented on the customer portal.

   Jack Waterworth, RHCE
   Senior Technical Support Engineer
   Red Hat Global Support Services
   919.610.2024 -- jack@redhat.com

On 07/11/2014 08:54 AM, Alfredo De Luca wrote:
> Hi Jack.
> Thanks for that. I did pretty much what you said but not sure how to
> re-create the initrd then install the grub.
> Do you have a specific procedure?
> I followed the procedure in attachment but it's slightly different
> from what I am looking for.
>
>
> On Thu, Jul 10, 2014 at 2:46 AM, Jack Waterworth <jack@redhat.com> wrote:
>> There is no way to do an in-place convert from a partitioned device to LVM
>> without losing data. I would recommend adding a new disk, reinstall the OS
>> on the new disk with LVM, and then moving over any data that was required
>> after installation.
>>
>> You may be able to do this in rescue mode within a chrooted environment, but
>> things could get messy. Add the new device, build the lvm stack, copy over
>> the data then chroot into the NEW lvm root. Mount everything appropriately,
>> recreate the initrd and re-install grub onto the new disk.  Go in with the
>> expectation that you may be fixing things after the reboot from rescue mode.
>>
>>    Jack Waterworth, RHCE
>>    Senior Technical Support Engineer
>>    Red Hat Global Support Services
>>    919.610.2024 -- jack@redhat.com
>>
>> On 07/08/2014 05:56 AM, Alfredo De Luca wrote:
>>> Hi all.
>>> I have red hat 5.7 with no lvm2 installed. Now I want to configure
>>> lvm2 on the root and swap partition then later on adding a couple of
>>> LUNs to create a VG
>>> What's the best practice/procedure to install lvm2 on the boot disk?
>>> Is it possible? I guess I have to run Linux CD in rescue mode
>>>
>>> Regards
>>>
>>>
>> _______________________________________________
>> linux-lvm mailing list
>> linux-lvm@redhat.com
>> https://www.redhat.com/mailman/listinfo/linux-lvm
>> read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/
>
>
>
>
> _______________________________________________
> linux-lvm mailing list
> linux-lvm@redhat.com
> https://www.redhat.com/mailman/listinfo/linux-lvm
> read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/


[-- Attachment #2: Type: text/html, Size: 4032 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-07-11 23:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-08  9:56 [linux-lvm] lvm2 conf on boot disk Alfredo De Luca
2014-07-09 16:46 ` Jack Waterworth
2014-07-11 12:54   ` Alfredo De Luca
2014-07-11 23:15     ` Jack Waterworth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).