Operating System - Linux
1820553 Members
2686 Online
109626 Solutions
New Discussion юеВ

How to mirror boot disk in Red Hat?

 
SOLVED
Go to solution
Michael Steele_2
Honored Contributor

How to mirror boot disk in Red Hat?

:-)
Support Fatherhood - Stop Family Law
11 REPLIES 11
Michal Kapalka (mikap)
Honored Contributor

Re: How to mirror boot disk in Red Hat?

Ivan Ferreira
Honored Contributor

Re: How to mirror boot disk in Red Hat?

During installation, you have the option to create a RAID for the OS. Create the partitions as software raid type and then use the RAID button to create RAID1 devices.

If you wan't to mirror after installation, check the documentation to migrate your current OS because the procedure is a little complicated and you must ensure that during RAID initialization you don't destroy your current data.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Michael Steele_2
Honored Contributor

Re: How to mirror boot disk in Red Hat?

Really not much of an effort put forth here. Need to see something step by step for 10 points.

Thanks!
Support Fatherhood - Stop Family Law
Ivan Ferreira
Honored Contributor

Re: How to mirror boot disk in Red Hat?

I think this is detailed enough.

http://trinityhome.org/misc/bootable-raid1.html
http://forums13.itrc.hp.com/service/forums/questionanswer.do?admit=109447627+1252208719478+28353475&threadId=1093327
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Michael Steele_2
Honored Contributor

Re: How to mirror boot disk in Red Hat?

Sigh.

I wish I could say this is what I'm looking for because I found this earlier and dismissed it for a couple of reasons. a) its not supported by red hat b) its so babblely with conditions.

Thanks though. But I'd really like to see a procedure from red hat.
Support Fatherhood - Stop Family Law
Matti_Kurkela
Honored Contributor

Re: How to mirror boot disk in Red Hat?

Then run a search in RHKB, silly!

http://kbase.redhat.com/faq/docs/DOC-4297

This is for RHEL4 and looks like it hasn't been updated since RHEL5 was released, so I believe it could be applicable with RHEL5 too.

RHEL also includes a LVM-level mirroring function, just like MirrorDisk in HP-UX. However, it is not very well known and recovery knowledge may be hard to find if there is an error. I've used it successfully on RHEL4 for on-line migration of a few systems from one SAN storage to another, though.

http://www.redhat.com/docs/manuals/csgfs/browse/4.5/SAC_Cluster_Logical_Volume_Manager/mirror_create.html

MK
MK
Michael Steele_2
Honored Contributor

Re: How to mirror boot disk in Red Hat?

8 pts for the rhel4 proceedure. Give me one for rhel5 and I'll give you 10 more.

Thanks Matt
Support Fatherhood - Stop Family Law
Michael Steele_2
Honored Contributor

Re: How to mirror boot disk in Red Hat?

PS - I hate the red hat search engine. You put in rhel5 mirror boot disk, or just mirror boot disk, and you 4 or 5,000 hits of misses. I've actually spent several hours looking before posting this request. I think part of the problem is terminology. I'm still learning linux speak.
Support Fatherhood - Stop Family Law
Steven E. Protter
Exalted Contributor
Solution

Re: How to mirror boot disk in Red Hat?

Shalom

bdf is an alias I created to make HP-UX command work in my pea brain molecules.

[root@bersheva ~]# bdf
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg00-lvol1
2.0G 758M 1.1G 41% /
/dev/mapper/vg00-lvol3
7.8G 3.2G 4.3G 43% /usr
/dev/mapper/vg00-lvol4
7.7G 531M 6.8G 8% /var
/dev/mapper/vg01-lvol0
184G 105G 70G 61% /share
/dev/hda1 99M 73M 22M 77% /boot

Note my boot is getting full. Time to pull out some old releases of the kernel.

fdisk -l
See what disks are available.

[root@bersheva ~]# fdisk -l

Disk /dev/hda: 20.4 GB, 20404101120 bytes
255 heads, 63 sectors/track, 2480 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 13 104391 83 Linux
/dev/hda2 14 2480 19816177+ 8e Linux LVM

Disk /dev/hdb: 200.0 GB, 200049647616 bytes
255 heads, 63 sectors/track, 24321 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/hdb doesn't contain a valid partition table

So we want to mirror the stuff on /dev/hda to /dev/hdb

Lets take a look at vg00 as I forced Linux to use hpux volume group names.
[root@bersheva ~]# vgdisplay -v vg00
Using volume group(s) on command line
Finding volume group "vg00"
--- Volume group ---
VG Name vg00
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 5
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 4
Open LV 4
Max PV 0
Cur PV 1
Act PV 1
VG Size 18.90 GB
PE Size 1.00 MB
Total PE 19351
Alloc PE / Size 19351 / 18.90 GB
Free PE / Size 0 / 0
VG UUID qiYEF9-L633-qUYg-KTsn-Lah1-wGqE-d2hrDb

--- Logical volume ---
LV Name /dev/vg00/lvol1
VG Name vg00
LV UUID 7cBaOF-DHmO-SMZM-sjM7-QuZ4-08nc-suNKz3
LV Write Access read/write
LV Status available
# open 1
LV Size 2.00 GB
Current LE 2048
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0

--- Logical volume ---
LV Name /dev/vg00/lvol3
VG Name vg00
LV UUID Yg9QNp-822v-0ZWw-AMsu-wJrB-iqew-YAFzzi
LV Write Access read/write
LV Status available
# open 1
LV Size 8.00 GB
Current LE 8196
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1

--- Logical volume ---
LV Name /dev/vg00/lvol4
VG Name vg00
LV UUID Duyc7u-F26Q-DQdx-ej3c-7Nyk-8sg2-yQD5ou
LV Write Access read/write
LV Status available
# open 1
LV Size 7.89 GB
Current LE 8083
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:2

--- Logical volume ---
LV Name /dev/vg00/lvol2
VG Name vg00
LV UUID 3V0brW-AnTz-FWYZ-MMX3-5I26-gsCD-7hwd3T
LV Write Access read/write
LV Status available
# open 1
LV Size 1.00 GB
Current LE 1024
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:3

--- Physical volumes ---
PV Name /dev/hda2
PV UUID 00RXtI-5nOp-qn6d-Tubr-un4c-3cEP-OnKfly
PV Status allocatable
Total PE / Free PE 19351 / 0


pvcreate /dev/hdb

fdisk /dev/hdb
# Carve up hdb into the same layout as /hda, leave the extra space left over for other use.

((If you want you can use dd to copy the data, but raid utilities do that for you already.))
vgextend vg00 /dev/hdb

[root@bersheva ~]# lvdisplay -v vg00
Using logical volume(s) on command line
--- Logical volume ---
LV Name /dev/vg00/lvol1
VG Name vg00
LV UUID 7cBaOF-DHmO-SMZM-sjM7-QuZ4-08nc-suNKz3
LV Write Access read/write
LV Status available
# open 1
LV Size 2.00 GB
Current LE 2048
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0

--- Logical volume ---
LV Name /dev/vg00/lvol3
VG Name vg00
LV UUID Yg9QNp-822v-0ZWw-AMsu-wJrB-iqew-YAFzzi
LV Write Access read/write
LV Status available
# open 1
LV Size 8.00 GB
Current LE 8196
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1

--- Logical volume ---
LV Name /dev/vg00/lvol4
VG Name vg00
LV UUID Duyc7u-F26Q-DQdx-ej3c-7Nyk-8sg2-yQD5ou
LV Write Access read/write
LV Status available
# open 1
LV Size 7.89 GB
Current LE 8083
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:2

--- Logical volume ---
LV Name /dev/vg00/lvol2
VG Name vg00
LV UUID 3V0brW-AnTz-FWYZ-MMX3-5I26-gsCD-7hwd3T
LV Write Access read/write
LV Status available
# open 1
LV Size 1.00 GB
Current LE 1024
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:3

In Linux /boot can not be part of lvm.

So basically, since we have used fdisk to carve the disk up the mirroring is pretty easy.

mdadm --create /dev/md0 --level=raid1 --raid-devices=2 /dev/sda1 /dev/sdb1
# This mirrors /boot

mdadm --create /dev/md1 --level=raid1 --raid-devices=2 /dev/sda1 /dev/sdb1
# This mirrors the LVM partition (see fdisk output)


lvmdiskscan (Since I didn't really do it I can't show you correct output here)

# cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sdb1[1] sda1[0]
4200896 blocks [2/2] [UU]

md2 : active raid1 sdb2[1] sda2[0]
10490304 blocks [2/2] [UU]

You do need to boot test this.

You need to use grub to make sure the system will actually boot off of either disk.

This article should suffice:
http://www.tux4u.nl/freedocs/linux/html/mirror-boot-26_howto.html

Source article:
http://thewatertower.org.uk/pages/linux-lvm.html

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Michael Steele_2
Honored Contributor

Re: How to mirror boot disk in Red Hat?

Oouu - that was a good one. Thanks SEP!
Support Fatherhood - Stop Family Law
Zinky
Honored Contributor

Re: How to mirror boot disk in Red Hat?

Mike...

You can actually have your LVM System VG sit on top of md (RAID devices).. or even forego LVM and just have your partitions rest on top of md devices (?).

Esily done at install time or even after he fact.

Good examples by our SEP though. Shalom sir.

Hakuna Matata

Favourite Toy:
AMD Athlon II X6 1090T 6-core, 16GB RAM, 12TB ZFS RAIDZ-2 Storage. Linux Centos 5.6 running KVM Hypervisor. Virtual Machines: Ubuntu, Mint, Solaris 10, Windows 7 Professional, Windows XP Pro, Windows Server 2008R2, DOS 6.22, OpenFiler