Sunteți pe pagina 1din 11

Blog Archive Installing OpenBSD 64Bit on a So...

http://www.iniy.org/?p=98

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: * * * * * * *
1 of 11

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
06/10/2011 04:44 PM

Blog Archive Installing OpenBSD 64Bit on a So...

http://www.iniy.org/?p=98

* Reboot into complete RAID environment OpenBSD will not boot from a RAIDframe RAID set at present, so wd0a and wd1a will be set aside as partitions to boot from. Kernel RAID autoconfiguration will prepare the RAID set at boot time, and mount the RAID partitions as per /etc/fstab.

Disk Preparation
I like to start with completely clean disks. If they have been used before, I wipe them before doing anything else, using dd(1). Boot from the OpenBSD distribution 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 Record and the BSD disklabel on each disk. wd0 will get a temporary installation of OpenBSD, but we will only keep the first partition when we are done. We will use this installation to configure and compile a kernel with RAID support. The following sizes will work:
Part ---a: c: d: e: f: g: Size ----512M ----1024M 512M 1024M 512M FS Type ------4.2BSD unused 4.2BSD 4.2BSD 4.2BSD 4.2BSD Purpose ------------------------------/ (becomes boot partition) Entire drive /usr /tmp /var /home

On wd1, we need two partitions; a boot partition, and a partition to contain the RAID set:
Part ---a: c: d: Size ----512M ----* FS Type ------4.2BSD unused RAID Purpose ------------------------------Boot partition Entire drive Everything except boot kernel

Its important to set the FS Type to RAID for the wd1d Partition, otherwise the System wont 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 activated softraid0 at root root on wd1a swap on wd1b dump on wd1b

2 of 11

06/10/2011 04:44 PM

Blog Archive Installing OpenBSD 64Bit on a So...


warning: /dev/console does not exist init: not found panic: no init Stopped at Debugger + 0x5 .... and so on

http://www.iniy.org/?p=98

Use the following commands to implement this:


fdisk -i wd0 disklabel -E wd0 ... fdisk -i wd1 disklabel -E wd1 ...

Reboot from media, and follow the normal installation procedure to install OpenBSD onto wd0. If you followed the steps above, all partitions will already be set up; simply quit disklabel(8) and move on to assigning partitions to their mount 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 code is on the CD:
mount /dev/cd0a /mnt cd /usr/src tar xzpf /mnt/src.tar.gz cd sys/arch/i386/conf

If you dont have the cd available you can get it also per FTP for name enter anonymous, for password just press ENTER
cd /usr/src ftp mirror.roothell.org Connected to mirror.roothell.org. 220 blog.roothell.org FTP server ready. Name (mirror.roothell.org:user123): anonymous 331 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.gz ftp> get /pub/OpenBSD/4.5/sys.tar.gz ./sys.tar.gz tar xzvvf src.tar.gz tar xzvvf sys.tar.gz

The configuration is the same as GENERIC, with two additions. Create a file called GENERIC.RAID in /usr/src/sys/arch/amd64/conf with the following
3 of 11 06/10/2011 04:44 PM

Blog Archive Installing OpenBSD 64Bit on a So...

http://www.iniy.org/?p=98

contents:
---Begin--# # GENERIC.RAID - Add kernelized RAIDframe driver # include "arch/amd64/conf/GENERIC" option pseudo-device ----End---RAID_AUTOCONFIG # Automatically configure RAID at boot raid 4 # RAIDframe disk driver

The following steps will build and install the new kernel:
config GENERIC.RAID cd ../compile/GENERIC.RAID make depend && make mv /bsd /bsd.original cp bsd /bsd chmod 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/rwd1a mount /dev/wd1a /mnt cp /bsd /mnt/bsd cp /usr/mdec/boot /mnt/boot /usr/mdec/installboot -v /mnt/boot /usr/mdec/biosboot wd1

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

4 of 11

06/10/2011 04:44 PM

Blog Archive Installing OpenBSD 64Bit on a So...


START array # rows (must be 1), columns, spare disks 1 2 0 START disks /dev/wd2d /dev/wd1d START layout # sectPerSU SUsPerParityUnit SUsPerReconUnit RAID_level 128 1 1 1 START queue # queue mode, outstanding request count fifo 100

http://www.iniy.org/?p=98

Notice that under disks, a (non-existent) wd2 is specified. When the RAID set is created, this serves as a placeholder, and will appear as failed. Once we are ready, we will hot-add wd0 as a spare and reconstruct the mirror on it. Once that is done, this configuration file will be updated to reflect the actual disk assignments. Now that you have this configuration file, implement it with:
raidctl -C /etc/raid0.conf raid0 raidctl -I 20050900 raid0 raidctl -iv raid0

The argument to -I is a unique identier that permits RAIDframe to determine which disks belong to which RAID sets; I used the year and month, plus 00 to indicate the rst RAID set. It is time to define the partitions on the RAID device. For my purposes, I used the following:
Part ---a: b: c: d: e: f: g: Size ----512M 1024M ----5G 5G 42G * FS Type ------RAID swap unused RAID RAID RAID RAID Purpose ------------------------------/ swap Entire drive /usr /tmp /var /home

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

5 of 11

06/10/2011 04:44 PM

Blog Archive Installing OpenBSD 64Bit on a So...

http://www.iniy.org/?p=98

newfs /dev/rraid0a newfs /dev/rraid0d newfs /dev/rraid0e newfs /dev/rraid0f newfs /dev/rraid0g raidctl -A root raid0

Copy the data from the initial installation over to the RAID partitions, making certain to preserve permissions:
mount /dev/raid0a /mnt (cd /; tar -Xcpf - .) | (cd /mnt; tar -xpf -) tar: Ustar cannot archive a socket ./dev/log umount /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/.sock tar: Ustar cannot archive a socket ./empty/dev/log umount /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 instead of the old wd0 partitions, and reboot:
mount /dev/raid0a /mnt sed 's/wd0/raid0/g' /mnt/etc/fstab > /mnt/etc/fstab.tmp mv /mnt/etc/fstab.tmp /mnt/etc/fstab umount /mnt reboot boot> boot wd1a:/bsd

Complete the Mirror Pair


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

There is no need to put a disklabel into the RAID partition, as this will be taken
6 of 11 06/10/2011 04:44 PM

Blog Archive Installing OpenBSD 64Bit on a So...

http://www.iniy.org/?p=98

care of when the mirror is reconstructed. To reconstruct the array, hot add wd0 as a new spare, and then start reconstruction. When reconstructions is complete, rebuild the parity. Note: Reconstruction and parity rewrite can take a long time. Do not reboot while this is in progress, or you may lose everything and need to start over.
raidctl -a /dev/wd0d raid0 raidctl -vF component0 raid0 raidctl -vP raid0

One last step remains; the RAID configuration file must be updated to remove the bogus wd2 entry and replace it with an entry for wd0:
sed 's/wd2/wd0/g' /etc/raid0.conf > /etc/raid0.conf.tmp mv /etc/raid0.conf.tmp /etc/raid0.conf

Reboot, and check the RAID status:


reboot ... raidctl -s raid0 raid0 Components: /dev/wd0d: optimal /dev/wd1d: optimal No spares. Parity status: clean Reconstruction 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 {im following your instruction} But I dont have the (boot) folder under /usr/mdec/ BTW Im installing this on Sun Netra 210 (Sparc64) ,

7 of 11

06/10/2011 04:44 PM

Blog Archive Installing OpenBSD 64Bit on a So...

http://www.iniy.org/?p=98

Thanks for your help

adminDecember 4th, 2009 at %I:%M %p Strange, in the INSTALL le it also says, that you have the boot program under /usr/mdec/boot. Caution! Its a le not a folder, perhaps this is your problem. quote from the INSTALL-file: You can nd the boot program in `/usr/mdec/boot in the OpenBSD/sparc64 distribution. 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. If you find a solution, please post it here too, so that other users can benefit also.

IssaDecember 5th, 2009 at %I:%M %p First Im using OpenBSD 4.6 (SPARC64) on Sun Netra 210 Server. This is what I have under /usr/mdec # cd /usr/mdec # ls -al total 480 drwxr-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 -rrr 1 root bin 50392 Jul 9 22:16 ofwboot -rrr 1 root bin 50680 Jul 9 22:16 ofwboot.net __________________________________________________ Question: Im having a LSI SAS1064 which support RAID 1 (Hardware). But I cant Access it using SUN Netra 210 because it doesnt have a BIOS but it has OBP 4.30. Is there a way to use OpenBSD to access that chip and congure it to use RAID 1 (using the hardware on the chip)and save all that headache (I dont want to use software raid because my hardware SUPPOSE to support Raid 1 on it) But I spend a lot of time reading the manuals and forums and Im getting now to no where.

8 of 11

06/10/2011 04:44 PM

Blog Archive Installing OpenBSD 64Bit on a So...

http://www.iniy.org/?p=98

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 -s Thats 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 1 Thants mean: Create Raid1 (r 1) on the controller #1 (This is the last number 1 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 issue this command: # raidctl -l (Small L) BTW Im using Sun Netra 210. I hope that will help some people who is , straggling in the same problem.

Leave a comment
Your comment
Security Code:

Name (required) Mail (will not be published) (required) Website

Submit Comment
Search for:

Search
06/10/2011 04:44 PM

9 of 11

Blog Archive Installing OpenBSD 64Bit on a So...

http://www.iniy.org/?p=98

Language
Deutsch English

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

Categories
Computer (technical) Education

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

Linkliste
geekdiscussions.org robertwalter.de/blog

10 of 11

06/10/2011 04:44 PM

Blog Archive Installing OpenBSD 64Bit on a So...

http://www.iniy.org/?p=98

is powered by WordPress | Entries RSS and Comments RSS Copyright 2008. All right reserved. Theme Design by Good Design Web

11 of 11

06/10/2011 04:44 PM

S-ar putea să vă placă și