linux-lvm.redhat.com archive mirror
 help / color / mirror / Atom feed
* [linux-lvm] is it possible to move lvm2 logvols?
@ 2007-09-11 22:42 Farkas Levente
  2007-09-12  5:06 ` Robert Sander
  0 siblings, 1 reply; 5+ messages in thread
From: Farkas Levente @ 2007-09-11 22:42 UTC (permalink / raw)
  To: linux-lvm

hi,
hi we've got a server with a lvm2 pv with a dozen of logvol in it. under
the lvm we'd like to create a raid1 array on 2 disk. unfortunately we
create raid0 under it. but the logvols contains a lots of important
data. we'd like to
- put 2 new disks into the system,
- create the raid1 array on it,
- put a new volgroup over the raid1,
- create the same size logvols in the new volgroup,
- and move the old logvols to the new logvols, but how can i do that?
everything is ok, except the last step. is there any easy way to do the
last step? can i use vgexport and vgimport for this? or can i use a
simple dd for it? or?
thank you for your help in advance.

-- 
  Levente                               "Si vis pacem para bellum!"

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

* Re: [linux-lvm] is it possible to move lvm2 logvols?
  2007-09-11 22:42 [linux-lvm] is it possible to move lvm2 logvols? Farkas Levente
@ 2007-09-12  5:06 ` Robert Sander
  2007-09-12 14:48   ` Farkas Levente
  0 siblings, 1 reply; 5+ messages in thread
From: Robert Sander @ 2007-09-12  5:06 UTC (permalink / raw)
  To: linux-lvm

On Wed, 12 Sep 2007 00:42:06 +0200,
 Farkas Levente <lfarkas@bppiac.hu> wrote:
> hi,
> hi we've got a server with a lvm2 pv with a dozen of logvol in it. under
> the lvm we'd like to create a raid1 array on 2 disk. unfortunately we
> create raid0 under it. but the logvols contains a lots of important
> data. we'd like to
> - put 2 new disks into the system,
> - create the raid1 array on it,
> - put a new volgroup over the raid1,

Hi!

Do not create a new vg.
Add the raid1 as a second pv to the existing vg.
Use pvmove to move the logical volumes from one pv to the other.
This is an online operatipn.

Greetings
-- 
Robert Sander                     Senior Manager Information Systems
Epigenomics AG    Kleine Praesidentenstr. 1    10178 Berlin, Germany
phone:+49-30-24345-0                            fax:+49-30-24345-555
http://www.epigenomics.com             robert.sander@epigenomics.com

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

* Re: [linux-lvm] is it possible to move lvm2 logvols?
  2007-09-12  5:06 ` Robert Sander
@ 2007-09-12 14:48   ` Farkas Levente
  2007-09-12 15:51     ` Farkas Levente
  2007-09-12 21:53     ` Stuart D. Gathman
  0 siblings, 2 replies; 5+ messages in thread
From: Farkas Levente @ 2007-09-12 14:48 UTC (permalink / raw)
  To: LVM general discussion and development

Robert Sander wrote:
> On Wed, 12 Sep 2007 00:42:06 +0200,
>  Farkas Levente <lfarkas@bppiac.hu> wrote:
>> hi,
>> hi we've got a server with a lvm2 pv with a dozen of logvol in it. under
>> the lvm we'd like to create a raid1 array on 2 disk. unfortunately we
>> create raid0 under it. but the logvols contains a lots of important
>> data. we'd like to
>> - put 2 new disks into the system,
>> - create the raid1 array on it,
>> - put a new volgroup over the raid1,
> 
> Hi!
> 
> Do not create a new vg.
> Add the raid1 as a second pv to the existing vg.
> Use pvmove to move the logical volumes from one pv to the other.
> This is an online operatipn.

ok everything seems to working. after i move the logvols i remove the
old pv and try to boot the system. now the problem during the boot linux
can't find the volume group so can't find it's / since the / is on the
first logvol of the vg. this on centos-5.
the strange thing if i boot from centos rescue dvd it see the vg and
logvols too and i can chroot /mnt/sysimage into the new real system.
what can be the reason that if i boot the new system it can't find the
vg and it's logvols?

-- 
  Levente                               "Si vis pacem para bellum!"

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

* Re: [linux-lvm] is it possible to move lvm2 logvols?
  2007-09-12 14:48   ` Farkas Levente
@ 2007-09-12 15:51     ` Farkas Levente
  2007-09-12 21:53     ` Stuart D. Gathman
  1 sibling, 0 replies; 5+ messages in thread
From: Farkas Levente @ 2007-09-12 15:51 UTC (permalink / raw)
  To: LVM general discussion and development

Farkas Levente wrote:
> Robert Sander wrote:
>> On Wed, 12 Sep 2007 00:42:06 +0200,
>>  Farkas Levente <lfarkas@bppiac.hu> wrote:
>>> hi,
>>> hi we've got a server with a lvm2 pv with a dozen of logvol in it. under
>>> the lvm we'd like to create a raid1 array on 2 disk. unfortunately we
>>> create raid0 under it. but the logvols contains a lots of important
>>> data. we'd like to
>>> - put 2 new disks into the system,
>>> - create the raid1 array on it,
>>> - put a new volgroup over the raid1,
>> Hi!
>>
>> Do not create a new vg.
>> Add the raid1 as a second pv to the existing vg.
>> Use pvmove to move the logical volumes from one pv to the other.
>> This is an online operatipn.
> 
> ok everything seems to working. after i move the logvols i remove the
> old pv and try to boot the system. now the problem during the boot linux
> can't find the volume group so can't find it's / since the / is on the
> first logvol of the vg. this on centos-5.
> the strange thing if i boot from centos rescue dvd it see the vg and
> logvols too and i can chroot /mnt/sysimage into the new real system.
> what can be the reason that if i boot the new system it can't find the
> vg and it's logvols?

already find the old initrd contains only raid0.ko so it can't find the
raid1 disk:-(

-- 
  Levente                               "Si vis pacem para bellum!"

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

* Re: [linux-lvm] is it possible to move lvm2 logvols?
  2007-09-12 14:48   ` Farkas Levente
  2007-09-12 15:51     ` Farkas Levente
@ 2007-09-12 21:53     ` Stuart D. Gathman
  1 sibling, 0 replies; 5+ messages in thread
From: Stuart D. Gathman @ 2007-09-12 21:53 UTC (permalink / raw)
  To: LVM general discussion and development

On Wed, 12 Sep 2007, Farkas Levente wrote:

> ok everything seems to working. after i move the logvols i remove the
> old pv and try to boot the system. now the problem during the boot linux
> can't find the volume group so can't find it's / since the / is on the
> first logvol of the vg. this on centos-5.
> the strange thing if i boot from centos rescue dvd it see the vg and
> logvols too and i can chroot /mnt/sysimage into the new real system.
> what can be the reason that if i boot the new system it can't find the
> vg and it's logvols?

centos-5 puts hardcoded lvm and md activation into the initrd init script.  

To see your init script,

# mkdir initrd
# cd initrd
# zcat /path/to/initrd...img | cpio -icvdmu
# cat init

A typical init script has lvm related parts similar to this:
----------
...
echo "Loading dm-mod.ko module"
insmod /lib/dm-mod.ko
echo "Loading dm-mirror.ko module"
insmod /lib/dm-mirror.ko
echo "Loading dm-zero.ko module"
insmod /lib/dm-zero.ko
echo "Loading dm-snapshot.ko module"
insmod /lib/dm-snapshot.ko
echo Making device-mapper control node
mkdmnod
mkblkdevs
raidautorun /dev/md3
raidautorun /dev/md4
echo Scanning logical volumes
lvm vgscan --ignorelockingfailure
echo Activating logical volumes
lvm vgchange -ay --ignorelockingfailure  rootvg
...
---------

You have to edit the script, make sure it activates any raid PVs your
VG depends on, and change the name of the VG containing root fs.

This is done automatically by mkinitrd.  But it has no
options to creat a script for a different LVM environment than the
one you are running on.  So you have to manually edit init and
package it back to a new initrd image with cpio.

# pwd
/.../initrd
# find * | cpio -ocv | gzip -9 >../newinitrd.img

This is not convenient.  Assuming mkinitrd was more adaptable, it
would still defeat much of the advantage of grub to have to remember
to run it to change LVM environment.  (Although, to be fair, this
usually happens only when migrating to new hardware.)

-- 
	      Stuart D. Gathman <stuart@bmsi.com>
    Business Management Systems Inc.  Phone: 703 591-0911 Fax: 703 591-6154
"Confutatis maledictis, flammis acribus addictis" - background song for
a Microsoft sponsored "Where do you want to go from here?" commercial.

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

end of thread, other threads:[~2007-09-12 21:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-11 22:42 [linux-lvm] is it possible to move lvm2 logvols? Farkas Levente
2007-09-12  5:06 ` Robert Sander
2007-09-12 14:48   ` Farkas Levente
2007-09-12 15:51     ` Farkas Levente
2007-09-12 21:53     ` Stuart D. Gathman

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).