LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-28-2006, 12:07 PM   #1
eyt
Member
 
Registered: Sep 2003
Posts: 76

Rep: Reputation: 15
Software Raid 1 installation


Hi all,

I have problem in installing RAID 1, it fails to reboot. Below lists the steps for my installation. I have no idea what go wrong. Any help is appreciated.

1. Set up raid 1 with2 SATA disks on Mandrake 10.1, /dev/sda and /dev/sdb
# df
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 1.1G 96M 964M 9% /
/dev/sda8 13G 33M 13G 1% /home
/dev/sda6 9.1G 1.3G 7.9G 14% /usr
/dev/sda7 89G 106M 89G 1% /var

2. create partitions on the /dev/sdb same as /dev/sda
# fdisk -l
Disk /dev/sda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 135 1084356 fd Linux raid autodetect
/dev/sda2 136 14593 116133885 5 Extended
/dev/sda5 136 268 1068291 fd Linux raid autodetect
/dev/sda6 269 1454 9526513+ fd Linux raid autodetect
/dev/sda7 1455 12962 92437978+ fd Linux raid autodetect
/dev/sda8 12963 14593 13100976 fd Linux raid autodetect

Disk /dev/sdb: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 1 135 1084356 fd Linux raid autodetect
/dev/sdb2 136 14593 116133885 5 Extended
/dev/sdb5 136 268 1068291 fd Linux raid autodetect
/dev/sdb6 269 1454 9526513+ fd Linux raid autodetect
/dev/sdb7 1455 12962 92437978+ fd Linux raid autodetect
/dev/sdb8 12963 14593 13100976 fd Linux raid autodetect

3. create and format raid devices mod0, md1, md2, md3 and md4 for /, home,usr,var and swap
# mdadm --create /dev/md0 --level=1 --raid-disks=2 missing /dev/sdb1
# mkresierfs /dev/md0
# mkswap /dev/md1

raid devices created successfully.

# cat /proc/mdstat
Personalities : [raid1]
md4 : active raid1 sdb8[0]
13100864 blocks [2/1] [U_]

md3 : active raid1 sdb7[0]
92437888 blocks [2/1] [U_]

md2 : active raid1 sdb6[0]
9526400 blocks [2/1] [U_]

md1 : active raid1 sdb5[0]
1068224 blocks [2/1] [U_]

md0 : active raid1 sdb1[0]
1084288 blocks [2/1] [U_]

unused devices: <none>

4. mount the raid devices md0,md1,md2,md3 and md4 to /mnt/newroot and copy the appropriate stuff from /dev/sda to the raid devices
# mount /dev/md0 /mnt/newroot
# cp -dpRx /dev/md1 /mnt/newroot

5. Edit /mnt/newroot/etc/fstab
# cat /mnt/newroot/etc/fstab
/dev/md0 / reiserfs notail 1 1
/dev/md4 /home reiserfs notail 1 2
/dev/hdd /mnt/cdrom auto umask=0,user,iocharset=iso8859-1,codepage=850,noauto,ro,exec,users 0 0
none /mnt/floppy supermount dev=/dev/fd0,fs=ext2:vfat,--,umask=0,iocharset=iso8859-1,sync,codepage=850 0 0
none /proc proc defaults 0 0
/dev/md2 /usr reiserfs notail 1 2
/dev/md3 /var reiserfs notail 1 2
/dev/md5 swap swap defaults 0 0

6. copy edited fstab to the first disk
# cp /mnt/newroot/etc/fstab /etc/fstab

7. create an initrd.img
# mkinitrd initrd.raid `uname -r`

8. Edit /mnt/newroot/grub/menu.lst
# cat /mnt/newroot/boot/grub/menu.lst
timeout 10
color black/cyan yellow/cyan
default 0

title LinuxRaid
kernel (hd1,0)/boot/vmlinuz root=/dev/md0 acpi=ht resume=/dev/md1 splash=silent vga=788
initrd (hd1,0)/boot/initrd.raid

title linux
kernel (hd0,0)/boot/vmlinuz root=/dev/sda1 acpi=ht resume=/dev/sda5 splash=silent vga=788
initrd (hd0,0)/boot/initrd-2.6.8.1-12mdk.img.orig

9. copy edited menu.lst to the first disk
cp /mnt/newroot/boot/grub/menu.lst /boot/grub/menu.lst

10. install grub
# grub
grub > device (hd0) /dev/sdb
grub > root (hd0,0)
grub > setup (hd0)
grub > quit


11. Now reboot the system and boot from 'LinuxRaid' from grub

12. The system fails to boot up and give the following messages:
Mounting root filesystem with flags notail
ReiserFs: md0: warning: sh-2006: read_super_block: bread fialed (dev md0, block 2, size 4096)


kernel panic: No init found init: option to kernel
 
Old 03-28-2006, 12:10 PM   #2
shorun
Member
 
Registered: Mar 2006
Location: belguim
Distribution: fedora, mandriva, suse
Posts: 148

Rep: Reputation: 15
your first partition is a linux raid partition, try to make a /boot (of about 100 mb should be fine) at the verry front of your primary master (where the mbr is located)

u cannot make a software partition on your mbr, this is not readable to your system.
 
Old 03-28-2006, 12:39 PM   #3
eyt
Member
 
Registered: Sep 2003
Posts: 76

Original Poster
Rep: Reputation: 15
Do I need to repartition /dev/sda and add a /boot partition and reinstall linux system on /dev/sda
 
Old 03-28-2006, 02:30 PM   #4
shorun
Member
 
Registered: Mar 2006
Location: belguim
Distribution: fedora, mandriva, suse
Posts: 148

Rep: Reputation: 15
make sure that the first drive (or whatever drive your bios go's to look for the MBR) is installed on a seperate partition at the front of the drive (where the MBR is located). give it mount point /boot and make it about 100 MB. this will make your system boot. you can then place your root ( / ) on the mirror if you like.

edit: you can usually write a new boot record with the boot cd (cd1). if it seems to hard/doesn't work you could allso reinstall the os thus reinstalling the bootloader.

there is only one downfall: IF the drive with /boot crashed you will no longer have a boot record. you can retrieve the data from the other drive but it won't be as easy as just plugging in a new drive.

Last edited by shorun; 03-28-2006 at 02:33 PM.
 
Old 03-28-2006, 10:33 PM   #5
eyt
Member
 
Registered: Sep 2003
Posts: 76

Original Poster
Rep: Reputation: 15
I am not sure if I understand your suggestion.
I want to mirror all the partitions of /dev/sda to /dev/sdb so that if one disk die, the system keeps on running and the system can boot on raid

1. If I reinstall OS on /dev/sda, is the 'first partition' have to be mounted to /boot. The other partitions are then mount to different mount points such as /root, /usr, /var, /home.

2. As I want to make the system can boot on RAID, do I need create raid devices for both /boot and /root partitions?
 
Old 03-29-2006, 05:02 AM   #6
shorun
Member
 
Registered: Mar 2006
Location: belguim
Distribution: fedora, mandriva, suse
Posts: 148

Rep: Reputation: 15
Quote:
Originally Posted by eyt
I am not sure if I understand your suggestion.
I want to mirror all the partitions of /dev/sda to /dev/sdb so that if one disk die, the system keeps on running and the system can boot on raid

1. If I reinstall OS on /dev/sda, is the 'first partition' have to be mounted to /boot. The other partitions are then mount to different mount points such as /root, /usr, /var, /home.

2. As I want to make the system can boot on RAID, do I need create raid devices for both /boot and /root partitions?
you should be able to put all partitions in a raid system, extept for /boot (where your bootloader is installed), since your bios will never understand a mirror. if you drive crashed you will have all your data in mirror on the other drive, exept for your /boot partition.

best try this setup:
drive partition mount point raid
sda 1 /boot none
sda 3 linux raid 1
sdb 1 linux raid 1

this should work perfectly. just make sure that /boot is your verry first partition of your first drive (sda) and all the other partitions can just be mirrored all the way you want it.

that should do it.

there is only 1 but: IF your sda fails you will lose your /boot thus your boot record. your data will stil be on /sdb (you you won't lose anything) but you will have to reinstall your bootloader if it crashes.
 
Old 03-29-2006, 08:15 AM   #7
shorun
Member
 
Registered: Mar 2006
Location: belguim
Distribution: fedora, mandriva, suse
Posts: 148

Rep: Reputation: 15
edit:

somehow managed to double post....
 
Old 03-30-2006, 10:16 AM   #8
eyt
Member
 
Registered: Sep 2003
Posts: 76

Original Poster
Rep: Reputation: 15
1. I reinstall the linux to /dev/sda and create a /boot partition to first disk of /dev/sda
2. I copy the same partition structure from /dev/sda to /dev/sdb
2. I create raid device for /root, /usr, /var, /home and swap but not for /boot
3. I edit the /mnt/newroot/etc/fstab as follows and copy it to /etc/fstab:

# cat /mnt/newroot/fstab
/dev/md0 / reiserfs notail 1 1
/dev/sda1 /boot reiserfs notail 1 2
/dev/md4 /home reiserfs notail 1 2
/dev/hdd /mnt/cdrom auto umask=0,user,iocharset=iso8859-1,codepage=850,noauto,ro,exec,users 0 0
none /mnt/floppy supermount dev=/dev/fd0,fs=ext2:vfat,--,umask=0,iocharset=iso8859-1,sync,codepage=850 0 0
none /proc proc defaults 0 0
/dev/md2 /usr reiserfs notail 1 2
/dev/md3 /var reiserfs notail 1 2
/dev/md1 swap swap defaults 0 0

# cp /mnt/newroot/etc/fstab /etc/fstab

4. Before the first reboot, I edit /boot/grub/menu.lst and boot to 'LinuxRaid' and boot fail.
Do I need to recreate the initrd image by command mkinitrd initrd.raid `uname -r` ?
Is there any error in the edited menu.lst?

# /cat /boot/grub/menu.lst

title LinuxRaid
kernel (hd1,0)/vmlinuz root=/dev/md0 acpi=ht resume=/dev/md1 splash=silent vga=788
initrd (hd0,0)/initrd.img

title linux
kernel (hd0,0)/vmlinuz root=/dev/sda5 acpi=ht resume=/dev/sda6 splash=silent vga=788
initrd (hd0,0)/initrd.img

Details of the devices:

# df
Filesystem Size Used Avail Use% Mounted on
/dev/sda5 793M 93M 700M 12% /
/dev/sda1 267M 35M 232M 14% /boot
/dev/sda9 9.4G 34M 9.4G 1% /home
/dev/sda7 7.9G 1.3G 6.6G 17% /usr
/dev/sda8 93G 105M 93G 1% /var

# fdisk -l
Device Boot Start End Blocks Id System
/dev/sda1 * 1 34 273073+ 83 Linux
/dev/sda2 35 14593 116945167+ 5 Extended
/dev/sda5 35 135 811251 fd Linux raid autodetect
/dev/sda6 136 268 1068291 fd Linux raid autodetect
/dev/sda7 269 1289 8201151 fd Linux raid autodetect
/dev/sda8 1290 13372 97056666 fd Linux raid autodetect
/dev/sda9 13373 14593 9807651 fd Linux raid autodetect

Device Boot Start End Blocks Id System
/dev/sdb1 1 34 273073+ 83 Linux
/dev/sdb2 35 14593 116945167+ 5 Extended
/dev/sdb5 35 135 811251 fd Linux raid autodetect
/dev/sdb6 136 268 1068291 fd Linux raid autodetect
/dev/sdb7 269 1289 8201151 fd Linux raid autodetect
/dev/sdb8 1290 13372 97056666 fd Linux raid autodetect
/dev/sdb9 13373 14593 9807651 fd Linux raid autodetect

# mdadm --create --auto /dev/md0 --level 1 --raid-devices=2 missing /dev/sdb5
# mdadm --create --auto /dev/md1 --level 1 --raid-devices=2 missing /dev/sdb6
# mdadm --create --auto /dev/md2 --level 1 --raid-devices=2 missing /dev/sdb7
# mdadm --create --auto /dev/md3 --level 1 --raid-devices=2 missing /dev/sdb8
# mdadm --create --auto /dev/md4 --level 1 --raid-devices=2 missing /dev/sdb9
 
Old 03-31-2006, 12:15 PM   #9
shorun
Member
 
Registered: Mar 2006
Location: belguim
Distribution: fedora, mandriva, suse
Posts: 148

Rep: Reputation: 15
ok, i'll paste my own fstab file here, witch works with 2 mirror's

LABEL=/1 / ext2 defaults 1 1
LABEL=/boot /boot ext2 defaults 1 2
/dev/md0 /data reiserfs noexec 1 2
none /dev/pts devpts gid=5,mode=620 0 0
none /dev/shm tmpfs defaults 0 0
none /proc proc defaults 0 0
none /sys sysfs defaults 0 0
LABEL=/tmp /tmp ext2 defaults 1 2
/dev/md2 /var ext3 defaults,usrquota,grpquota 1 2
LABEL=SWAP-hda3 swap swap defaults 0 0
/dev/hdc /media/cdrecorder auto pamconsole,exec,noauto,managed 0 0

and here my menu.lst

#boot=/dev/hda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Fedora Core (2.6.12-1.1381_FC3)
root (hd0,0)
kernel /vmlinuz-2.6.12-1.1381_FC3 ro root=LABEL=/1 rhgb quiet
initrd /initrd-2.6.12-1.1381_FC3.img
title Fedora Core (2.6.9-1.667)
root (hd0,0)
kernel /vmlinuz-2.6.9-1.667 ro root=LABEL=/1 rhgb quiet
initrd /initrd-2.6.9-1.667.img

i really can't figure out where your problem is, but maybe by comparing you can figure it out yourselve.

the config u see is working at this verry moment.
i did notice you have your swap mirrored, i do not know if this might be the problem but i don't see anything else that could be wrong.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Why can't I mount this md0 raid? (mdadm and software raid) cruiserparts Linux - Software 35 01-05-2013 03:35 PM
Creating software mirror raid during installation hq4ever Fedora 1 02-21-2006 09:09 AM
Software RAID Configuration during Linux Installation manjinder Linux - Enterprise 1 11-15-2004 12:57 PM
moving system from ide software raid to new box with scsi raid ftumsh Linux - General 0 10-28-2003 09:34 AM
Software RAID & Installation Problems Dr_Cooke Linux - General 1 09-19-2003 11:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:20 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration