intalling openbsd 64bit on raid1

11
Home About Impressum Installing OpenBSD 64Bit on a Software Raid 1 (Mirroring) Credits This very good article is written by Marcus Redivo. http://www.eclectica.ca/howto/openbsd-software-raid-howto.php I added a warning to stress one point (see red font) which took me 5 hours to find the error, the rest is the orginal tutorial, have fun. Installing OpenBSD 64Bit on a Software Raid 1 (Mirroring) This document describes how to set up RAID mirroring on OpenBSD with the RAIDframe driver built into the kernel. Overview This procedure assumes OpenBSD 4.5, the amd64 architecture (should work with any other architecture too), and two 320GB sata disks; wd0 and wd1. The steps involved are: * Install OpenBSD on wd0 * Compile a kernel that supports RAID * Reboot into RAID-enabled kernel * Configure RAID partitions on wd1 as half of a broken mirror * Copy all files onto the RAID partitions * Reboot into broken mirror * Reallocate wd0, hot-add it, and reconstruct the broken mirror » Blog Archive » Installing OpenBSD 64Bit on a So... http://www.iniy.org/?p=98 1 of 11 06/10/2011 04:44 PM

Upload: aleksei-kurepin

Post on 11-Mar-2015

123 views

Category:

Documents


10 download

TRANSCRIPT

Page 1: Intalling OpenBSD 64bit on RAID1

HomeAboutImpressum

Installing OpenBSD 64Bit on aSoftware Raid 1 (Mirroring)

Credits

This very good article is written by Marcus Redivo.http://www.eclectica.ca/howto/openbsd-software-raid-howto.php

I added a warning to stress one point (see red font) which took me 5 hours tofind the error, the rest is the orginal tutorial, have fun.

Installing OpenBSD 64Bit on aSoftware Raid 1 (Mirroring)This document describes how to set up RAID mirroring on OpenBSD with theRAIDframe driver built into the kernel.

Overview

This procedure assumes OpenBSD 4.5, the amd64 architecture (should workwith any other architecture too), and two 320GB sata disks; wd0 and wd1. Thesteps involved are:

* Install OpenBSD on wd0* Compile a kernel that supports RAID* Reboot into RAID-enabled kernel* Configure RAID partitions on wd1 as half of a broken mirror* Copy all files onto the RAID partitions* Reboot into broken mirror* Reallocate wd0, hot-add it, and reconstruct the broken mirror

» Blog Archive » Installing OpenBSD 64Bit on a So... http://www.iniy.org/?p=98

1 of 11 06/10/2011 04:44 PM

Page 2: Intalling OpenBSD 64bit on RAID1

* Reboot into complete RAID environment

OpenBSD will not boot from a RAIDframe RAID set at present, so wd0a andwd1a will be set aside as partitions to boot from. Kernel RAIDautoconfiguration will prepare the RAID set at boot time, and mount the RAIDpartitions as per /etc/fstab.

Disk Preparation

I like to start with completely clean disks. If they have been used before, I wipethem before doing anything else, using dd(1). Boot from the OpenBSDdistribution CD to get a shell, and execute:

dd if=/dev/zero of=/dev/rwd0c bs=1024000 &dd if=/dev/zero of=/dev/rwd1c bs=1024000 &

This will take a while. To keep busy, you can set up the Master Boot Recordand the BSD disklabel on each disk.

wd0 will get a temporary installation of OpenBSD, but we will only keep thefirst partition when we are done. We will use this installation to configure andcompile a kernel with RAID support. The following sizes will work:

Part Size FS Type Purpose---- ----- ------- ------------------------------- a: 512M 4.2BSD / (becomes boot partition) c: ----- unused Entire drive d: 1024M 4.2BSD /usr e: 512M 4.2BSD /tmp f: 1024M 4.2BSD /var g: 512M 4.2BSD /home

On wd1, we need two partitions; a boot partition, and a partition to contain theRAID set:

Part Size FS Type Purpose---- ----- ------- ------------------------------- a: 512M 4.2BSD Boot partition c: ----- unused Entire drive d: * RAID Everything except boot kernel

It’s important to set the FS Type to RAID for the wd1d Partition,otherwise the System won’t boot !If later during boot you get the following error, check the FS Type with“disklabel wd1″ and set it to RAID, if this not the case

Kernelized RAIDframe activatedsoftraid0 at rootroot on wd1a swap on wd1b dump on wd1b

» Blog Archive » Installing OpenBSD 64Bit on a So... http://www.iniy.org/?p=98

2 of 11 06/10/2011 04:44 PM

Page 3: Intalling OpenBSD 64bit on RAID1

warning: /dev/console does not existinit: not foundpanic: no initStopped at Debugger + 0x5 .... and so on

Use the following commands to implement this:

fdisk -i wd0disklabel -E wd0...

fdisk -i wd1disklabel -E wd1...

Reboot from media, and follow the normal installation procedure to installOpenBSD onto wd0. If you followed the steps above, all partitions will alreadybe set up; simply quit disklabel(8) and move on to assigning partitions to theirmount points. If you started here, use the instructions above while in disklabel.

Make a RAID-Capable Kernel

To build a kernel, we need the source code, and a configuration. Source codeis on the CD:

mount /dev/cd0a /mntcd /usr/srctar xzpf /mnt/src.tar.gzcd sys/arch/i386/conf

If you don’t have the cd available you can get it also per FTPfor name enter “anonymous”, for password just press ENTER

cd /usr/srcftp mirror.roothell.orgConnected to mirror.roothell.org.220 blog.roothell.org FTP server ready.Name (mirror.roothell.org:user123): anonymous331 Guest login ok, send your email address as password.Password:230 Guest login ok, access restrictions apply.Remote system type is UNIX.Using binary mode to transfer files.ftp> get /pub/OpenBSD/4.5/src.tar.gz ./src.tar.gzftp> get /pub/OpenBSD/4.5/sys.tar.gz ./sys.tar.gz

tar xzvvf src.tar.gztar xzvvf sys.tar.gz

The configuration is the same as GENERIC, with two additions. Create a filecalled GENERIC.RAID in /usr/src/sys/arch/amd64/conf with the following

» Blog Archive » Installing OpenBSD 64Bit on a So... http://www.iniy.org/?p=98

3 of 11 06/10/2011 04:44 PM

Page 4: Intalling OpenBSD 64bit on RAID1

contents:

---Begin---## GENERIC.RAID - Add kernelized RAIDframe driver#

include "arch/amd64/conf/GENERIC"

option RAID_AUTOCONFIG # Automatically configure RAID at boot

pseudo-device raid 4 # RAIDframe disk driver

----End----

The following steps will build and install the new kernel:

config GENERIC.RAIDcd ../compile/GENERIC.RAIDmake depend && makemv /bsd /bsd.originalcp bsd /bsdchmod 644 /bsd

Now reboot into the RAID-enabled kernel.

Second Disk Setup – Make A Broken Mirror

To prepare the second disk, we need to accomplish the following:

* Make it bootable* Create a RAID configuration* Apply the configuration to the disk* Create a disklabel for the RAID device* Create filesystems in the RAID device partitions* Make the RAID device autoconfigurable* Copy our installation onto the new partitions* Update fstab to refer to the RAID device* Reboot into the RAID environment

Make the second disk (wd1) bootable:

newfs /dev/rwd1amount /dev/wd1a /mntcp /bsd /mnt/bsdcp /usr/mdec/boot /mnt/boot/usr/mdec/installboot -v /mnt/boot /usr/mdec/biosboot wd1

Create /etc/raid0.conf, which should look like this:

» Blog Archive » Installing OpenBSD 64Bit on a So... http://www.iniy.org/?p=98

4 of 11 06/10/2011 04:44 PM

Page 5: Intalling OpenBSD 64bit on RAID1

START array# rows (must be 1), columns, spare disks1 2 0

START disks/dev/wd2d/dev/wd1d

START layout# sectPerSU SUsPerParityUnit SUsPerReconUnit RAID_level128 1 1 1

START queue# queue mode, outstanding request countfifo 100

Notice that under disks, a (non-existent) wd2 is specified. When the RAID setis created, this serves as a placeholder, and will appear as failed. Once we areready, we will hot-add wd0 as a spare and reconstruct the mirror on it. Oncethat is done, this configuration file will be updated to reflect the actual diskassignments.

Now that you have this configuration file, implement it with:

raidctl -C /etc/raid0.conf raid0raidctl -I 20050900 raid0raidctl -iv raid0

The argument to -I is a unique identifier that permits RAIDframe to determinewhich disks belong to which RAID sets; I used the year and month, plus ’00′ toindicate the first RAID set.

It is time to define the partitions on the RAID device. For my purposes, I usedthe following:

Part Size FS Type Purpose---- ----- ------- ------------------------------- a: 512M RAID / b: 1024M swap swap c: ----- unused Entire drive d: 5G RAID /usr e: 5G RAID /tmp f: 42G RAID /var g: * RAID /home

Again, we use disklabel(8) to put this into effect. Once that is done, createfilesystems in the partitions that need them, and make the RAID setauto-configurable as a root filesystem:

disklabel -E raid0...

» Blog Archive » Installing OpenBSD 64Bit on a So... http://www.iniy.org/?p=98

5 of 11 06/10/2011 04:44 PM

Page 6: Intalling OpenBSD 64bit on RAID1

newfs /dev/rraid0anewfs /dev/rraid0dnewfs /dev/rraid0enewfs /dev/rraid0fnewfs /dev/rraid0graidctl -A root raid0

Copy the data from the initial installation over to the RAID partitions, makingcertain to preserve permissions:

mount /dev/raid0a /mnt(cd /; tar -Xcpf - .) | (cd /mnt; tar -xpf -)tar: Ustar cannot archive a socket ./dev/logumount /mnt

mount /dev/raid0d /mnt(cd /usr; tar -cpf - .) | (cd /mnt; tar -xpf -)umount /mnt

mount /dev/raid0f /mnt(cd /var; tar -cpf - .) | (cd /mnt; tar -xpf -)tar: Ustar cannot archive a socket ./cron/tabs/.socktar: Ustar cannot archive a socket ./empty/dev/logumount /mnt

mount /dev/raid0g /mnt(cd /home; tar -cpf - .) | (cd /mnt; tar -xpf -)umount /mnt

(You can ignore the errors; the sockets will be recreated.)

Update /etc/fstab on the broken mirror to point to the raid0 partitions insteadof the old wd0 partitions, and reboot:

mount /dev/raid0a /mntsed 's/wd0/raid0/g' /mnt/etc/fstab > /mnt/etc/fstab.tmpmv /mnt/etc/fstab.tmp /mnt/etc/fstabumount /mntreboot

boot> boot wd1a:/bsd

Complete the Mirror Pair

The last step is to integrate the first disk into the mirror pair. We need toupdate the wd0 disklabel to match wd1, which is easily done by copying:

disklabel wd1 >disklabel.wd1disklabel -R wd0 disklabel.wd1

There is no need to put a disklabel into the RAID partition, as this will be taken

» Blog Archive » Installing OpenBSD 64Bit on a So... http://www.iniy.org/?p=98

6 of 11 06/10/2011 04:44 PM

Page 7: Intalling OpenBSD 64bit on RAID1

care of when the mirror is reconstructed.

To reconstruct the array, hot add wd0 as a new spare, and then startreconstruction. When reconstructions is complete, rebuild the parity.

Note: Reconstruction and parity rewrite can take a long time. Do not rebootwhile this is in progress, or you may lose everything and need to start over.

raidctl -a /dev/wd0d raid0raidctl -vF component0 raid0raidctl -vP raid0

One last step remains; the RAID configuration file must be updated to removethe bogus wd2 entry and replace it with an entry for wd0:

sed 's/wd2/wd0/g' /etc/raid0.conf > /etc/raid0.conf.tmpmv /etc/raid0.conf.tmp /etc/raid0.conf

Reboot, and check the RAID status:

reboot

...

raidctl -s raid0raid0 Components: /dev/wd0d: optimal /dev/wd1d: optimalNo spares.Parity status: cleanReconstruction is 100% complete.Parity Re-write is 100% complete.Copyback is 100% complete.

September 27th, 2009 in Computer (technical)

Comments (4)

IssaDecember 3rd, 2009 at %I:%M %p

I get to this point:cp /usr/mdec/boot /mnt/boot {i’m following your instruction}

But I don’t have the (boot) folder under /usr/mdec/

BTW, I’m installing this on Sun Netra 210 (Sparc64)

» Blog Archive » Installing OpenBSD 64Bit on a So... http://www.iniy.org/?p=98

7 of 11 06/10/2011 04:44 PM

Page 8: Intalling OpenBSD 64bit on RAID1

Thanks for your help

adminDecember 4th, 2009 at %I:%M %p

Strange, in the INSTALL file it also says, that you have the boot programunder /usr/mdec/boot. Caution! It’s a file not a folder, perhaps this is yourproblem.

quote from the INSTALL-file:You can find the boot program in `/usr/mdec/boot’ in the OpenBSD/sparc64distribution.

http://ftp.eu.openbsd.org/pub/OpenBSD/4.5/sparc64/INSTALL.sparc64

Normally it should also be possible to copy the file from /boot to /mnt/boot. Ifyou find a solution, please post it here too, so that other users can benefit also.

IssaDecember 5th, 2009 at %I:%M %p

First I’m using OpenBSD 4.6 (SPARC64) on Sun Netra 210 Server.

This is what I have under /usr/mdec# cd /usr/mdec# ls -altotal 480drwxr-xr-x 2 root wheel 512 Jul 9 22:16 .drwxr-xr-x 17 root wheel 512 Jul 9 22:01 ..-r-xr-xr-x 1 root bin 4893 Jul 9 22:16 bootblk-r-xr-xr-x 1 root bin 132368 Jul 9 22:16 installboot-r–r–r– 1 root bin 50392 Jul 9 22:16 ofwboot-r–r–r– 1 root bin 50680 Jul 9 22:16 ofwboot.net__________________________________________________Question: I’m having a LSI SAS1064 which support RAID 1 (Hardware). But Ican’t Access it using SUN Netra 210 because it doesn’t have a BIOS but it hasOBP 4.30. Is there a way to use OpenBSD to access that chip and configure itto use RAID 1 (using the hardware on the chip)and save all that headache (Idon’t want to use software raid because my hardware SUPPOSE to supportRaid 1 on it) But I spend a lot of time reading the manuals and forums and I’mgetting now to no where.

» Blog Archive » Installing OpenBSD 64Bit on a So... http://www.iniy.org/?p=98

8 of 11 06/10/2011 04:44 PM

Page 9: Intalling OpenBSD 64bit on RAID1

Can you give me a hint?

IssaDecember 7th, 2009 at %I:%M %p

I solve it by using Solaris 10 DVD. This is what I did:1) At the ok prompt I typed:ok boot cdrom -sThat’s mean boot from the cdrom using single user mode.2) then I ran this command:# raidctl -C “0.0.0 0.1.0″ -r 1 1Thant’s mean: Create Raid1 (r 1) on the controller #1 (This is the last number1 in the command) using Disk0 (0.0.0) and my Disk1 (0.1.0).

You can find out which controller and disks your LSI SAS1064 using by issuethis command:# raidctl -l(Small L)BTW, I’m using Sun Netra 210. I hope that will help some people who isstraggling in the same problem.

Leave a commentYour commentSecurity Code:

Name (required)

Mail (will not be published) (required)

Website

Submit Comment

Search for: Search

» Blog Archive » Installing OpenBSD 64Bit on a So... http://www.iniy.org/?p=98

9 of 11 06/10/2011 04:44 PM

Page 10: Intalling OpenBSD 64bit on RAID1

Language

DeutschEnglish

Recent Posts

nice hibernate annotation tutorial(Deutsch) Studieren oder nicht studieren, das ist hier die Fragehow to become a good system administratorInstalling Glassfish 3.1 on headless Centos 5.5Mounting ReadyNAS CIFS Volume under Ubuntu Linux

Categories

Computer (technical)Education

Archives

March 2011February 2011December 2010November 2010October 2010July 2010June 2010January 2010December 2009November 2009October 2009September 2009July 2009May 2009April 2009March 2009

Linkliste

geekdiscussions.orgrobertwalter.de/blog

» Blog Archive » Installing OpenBSD 64Bit on a So... http://www.iniy.org/?p=98

10 of 11 06/10/2011 04:44 PM

Page 11: Intalling OpenBSD 64bit on RAID1

is powered by WordPress | Entries RSS and Comments RSS

Copyright © 2008. All right reserved. Theme Design by Good Design Web

» Blog Archive » Installing OpenBSD 64Bit on a So... http://www.iniy.org/?p=98

11 of 11 06/10/2011 04:44 PM