Skip to contentSkip to conversation

Setup for RAID1 with LVM

linux-lvm Jens Bruckmann 3 participants 3 messages Feb 8, 2001

lore
Share & tools
lore
#0 lore raw

Dear LVM-Specialists,

I would like to setup a configuration with LVM and RAID1. Poorly you can't just do a lvextend -m 1 like on HP-UX :-))

I could not find any hints so far for a step by step description, the part has to be included in the LVM-Howto.

I have two SCSI-Disks of nearly the same size, on Disk 1 I already have a working installation of Linux.

/usr, /opt and /var reside on LVs. I want these three LVs to be mirrored online to the second disk as it is possible on HP-UX.

Can someone shortly describe, how to setup such a configuration?

Thanks for help,

Jens

Signature · 7 lines
-----------------------------------------------------------------------
Jens Bruckmann              .-.       Mail:    [email protected]
SuSE Linux Solutions AG     /v\       Phone:   +49 - 40 - 89 69 82 18
Friesenweg 5F              // \\      Fax:     +49 - 40 - 85 40 04 35
D-22763 Hamburg           /(   )\
                           ^^-^^      
-----------------------------------------------------------------------
#1 lore raw

I'm not an expert to say the least and I have only known raid and LVM for few weeks but
from what I have managed to do myself, it is pretty straigt forward. I am using Debian kernel 2.4.1 (with Raid, LVM, and reiserfs support) The lvm tools are lvm_0.9.1_beta3. Unfortunatly what you are attempting to do, transfer an existing (working) system to a mirrored system. I haven't tried, and probably won't :-)

2 x 20gb drives hda hdb

On hda do a small install on the first partition of 500mb, and a swap, hdb partitioned in the same way with the swap active.
Setup the Raid (kernel etc) reboot on that kernel of course. Install the lvm stuff.

Then I do this :-)

hda / 500
/swap 512
/ (the rest RAID auto)

hdb /500
/swap 512
/ (The rest RAID auto)

Setup the raidtab business.
Reboot, and normaly I can create an md device with hda3 and hdb3. Then pvcreate /dev/md0
Then vgcreate toto /dev/md0
Then lvcreate my /dev/toto/usr /var /home etc...
Format them or reiser them as in my case.
copy everything from /xxx /dev/toto/xxx using the super command find . |cpio -pm /mnt

Then I have something like this.

Filesystem            Size  Used Avail Use% Mounted on
/dev/hda1             656M  421M  202M  68% /
/dev/lvdev/home       484M   23k  459M   0% /home
/dev/lvdev/var        484M   22M  437M   5% /var
/dev/lvdev/usr        484M  422M   37M  92% /usr

At the moment I am trying to decide if this is any use to me :-) I would also like to be able to mirror the / but I haven't been able to yet(any help gratefully recieved). And I don't know if this is how others are doing it.

Comments more than welcome, I would like to perfect thsi :-)

James

Quoted 34 lines · Jens Bruckmann

Dear LVM-Specialists,

I would like to setup a configuration with LVM and RAID1. Poorly you can't just do a lvextend -m 1 like on HP-UX :-))

I could not find any hints so far for a step by step description, the part has to be included in the LVM-Howto.

I have two SCSI-Disks of nearly the same size, on Disk 1 I already have a working installation of Linux.

/usr, /opt and /var reside on LVs. I want these three LVs to be mirrored online to the second disk as it is possible on HP-UX.

Can someone shortly describe, how to setup such a configuration?

Thanks for help,

Jens

Signature · 11 lines
-----------------------------------------------------------------------
Jens Bruckmann              .-.       Mail:    [email protected]
SuSE Linux Solutions AG     /v\       Phone:   +49 - 40 - 89 69 82 18
Friesenweg 5F              // \\      Fax:     +49 - 40 - 85 40 04 35
D-22763 Hamburg           /(   )\
                           ^^-^^      
-----------------------------------------------------------------------
_______________________________________________
linux-lvm mailing list
[email protected]
http://lists.sistina.com/mailman/listinfo/linux-lvm
#2 lore raw
In reply to Jens Bruckmann

Jens, you write:

Quoted 5 lines

I would like to setup a configuration with LVM and RAID1. Poorly you can't just do a lvextend -m 1 like on HP-UX :-))

I have two SCSI-Disks of nearly the same size, on Disk 1 I already have a working installation of Linux.

You need to use MD to do mirroring on Linux, not LVM (as in HP-UX and AIX).

Quoted 2 lines

/usr, /opt and /var reside on LVs. I want these three LVs to be mirrored online to the second disk as it is possible on HP-UX.

You _may_ be able to create an MD RAID-0 mirror of your existing disk, and then run vgscan again to detect the new configuration. However, this has probably never been done - normally, you would create the MD mirror first and then create VG/LV on top of it. It may NOT work, because I recall something about MD storing a backup superblock at the end of the MD device, and this would break LVM I think (LVM aligns the PEs at the end of the partition as well).

Quoted 1 line

Can someone shortly describe, how to setup such a configuration?

The safest would be to backup your system, and start with creating an MD device, and then adding LVM on top of it. If you have a backup, you could test to see if mirroring an existing LVM disk works, because this may be something people want to do in the future.

It is also be possible (if you have extra disk space) to create a mirrored MD device, make a PV of it, add it into the VG, and pvmove all of your existing LVs to the mirrored device. You can then vgreduce the old (unmirrored) PV out of the VG.

Cheers, Andreas

Signature · 3 lines
Andreas Dilger  \ "If a man ate a pound of pasta and a pound of antipasto,
                 \  would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/               -- Dogbert