tech stuff.

Installing OpenBSD/amd64 5.1 using softraid

with 8 comments

OpenBSD 5.1 added support for placing the root partition on a softraid(4) volume for the amd64, i386 & sparc64 architectures.  You can boot the system from the softraid RAID1 volume on amd64 ONLY.  Other architectures still require the kernel to be located on a non-softraid device.  This article details my experience installing OpenBSD 5.1 on amd64 to take advantage of these new features.

General Notes on this transcript:

  • I was installing to two identical 320GB SATA disks, so my install targets were sd0 & sd1.
  • The bold text represents keyboard input.

Creating the softraid volume is a manual process that must be done before running the installer.  Boot the install disk and choose to drop to a shell when asked:

(I)nstall, (U)pgrade or (S)hell? s

By default, only the sd0 devices will exist.  We will need to create device nodes for the second disk (sd1) and what will eventually be the RAID volume (sd2).

# cd /dev && sh /dev/MAKEDEV sd1 sd2

Initialize the MBR partitions.  I’m using the entire disks for OpenBSD.

# fdisk -iy sd0
Writing MBR at offset 0.
fdisk -iy sd1
Writing MBR at offset 0.

Now we need to create the BSD disk labels.  Since I’m installing amd64 I don’t really need a separate partition for the kernel, but I’m going to create one anyway in case I discover a compelling reason to use this in the future.

# disklabel -E sd0
Label editor (enter '?' for help at any prompt
> a a
offset: [64]
size: [2097152] 100m
Rounding size to cylinder (16065 sectors): 208781
FS type: [4.2BSD]
Rounding size to bsize (32 sectors): 208768
> a d
offset: [208832]
size: [624928513]
FS type: [4.2BSD] RAID
> q
Write new label?: [y] y
# cd /tmp && disklabel sd0 > disklabel.txt
# disklabel -R sd1 disklabel.txt

Ok, so that’s the disk labels.  Now we can construct the RAID volume.  Everyone always says it’s a best practice to zero the start of the volume, so I’ll do that, too.

# bioctl -c 1 -l /dev/sd0d,/dev/sd1d softraid0
sd2 at scsibus2 targ 1 lun 0: <OPENBSD, SR RAID 1, 005> SCSI2 0/direct fixed
sd2: 305140MB, 512 bytes/sector, 624927985 sectors
softraid0: SR RAID 1 volume attached as sd2
# dd if=/dev/zero of=/dev/rsd2c bs=1m count=1
1+0 records in
1+0 records out
1048576 bytes transferred in 0.012 secs (80914885 bytes/sec) 

That’s all there is to creating a RAID volume.  At this point we can exit the shell and install as normal.

# exit
(I)nstall, (U)pgrade or (S)hell? i

Continue with the install as normal up until the disk setup section.  I would heartily recommend using DUIDs for /etc/fstab in case device numbers change.  I’m planning on adding more disks to this host, and I’m not sure if the softraid will assemble to sd2 after that happens.

Available disks are: sd0 sd1 sd2.
Which one is the root disk? (or ‘done’) [sd0] sd2
Use DUIDs rather than device names in fstab? [yes]
MBR has invalid signature; not showing it.
Use (W)hole disk or (E)dit the MBR? [whole]
Setting OpenBSD MBR partition to whole sd2...done.

I’m a big fan of the automatic filesystem layout.  How great is that.

Use (A)uto layout, (E)dit auto layout, or create (C)ustom layout? [a] A

From here just continue through the setup as normal.  Some closing thoughts:

  • Unlike previous versions of softraid on OpenBSD, you won’t need to set up a daily altroot sync.  Obviously.
  • On amd64, you won’t have to worry about using installboot to update the boot blocks after an upgrade.  This is because installboot now has enough intelligence to examine softraid configuration and determine the physical disks which should receive the boot blocks.  Sweet.
References:

Updated 2011/10/08: Corrected typo in installboot command.

Updated 2012/06/18: Major rewrite for OpenBSD 5.1 and root-on-softraid.

Advertisements

Written by Lee Verberne

2011/03/16 at 09:35

8 Responses

Subscribe to comments with RSS.

  1. For some reason, installboot didn’t work as it should:

    # ls -l /altroot/
    total 49344
    -rw-r–r– 1 root wheel 578 Mar 2 2011 .cshrc
    -rw-r–r– 1 root wheel 468 Mar 2 2011 .profile
    drwxr-xr-x 2 root wheel 512 Mar 2 2011 altroot
    drwxr-xr-x 2 root wheel 1024 Mar 2 2011 bin
    -r-xr-xr-x 1 root wheel 44848 Oct 7 21:39 boot
    -rw-r–r– 1 root wheel 8975256 Oct 7 21:27 bsd
    -rw-r–r– 1 root wheel 7185913 Oct 7 21:26 bsd.rd
    -rw-r–r– 1 root wheel 8943115 Oct 7 21:26 bsd.sp
    drwxr-xr-x 3 root wheel 23552 Oct 7 21:41 dev
    drwxr-xr-x 21 root wheel 2560 Oct 7 21:42 etc
    drwxr-xr-x 2 root wheel 512 Oct 7 21:25 home
    drwxr-xr-x 2 root wheel 512 Mar 2 2011 mnt
    drwx—— 2 root wheel 512 Oct 7 21:31 root
    drwxr-xr-x 2 root wheel 1536 Mar 2 2011 sbin
    drwxr-xr-x 2 root wheel 512 Mar 2 2011 stand
    lrwxr-xr-x 1 root wheel 11 Oct 7 21:35 sys -> usr/src/sys
    drwxr-xr-x 2 root wheel 512 Oct 7 21:25 tmp
    drwxr-xr-x 2 root wheel 512 Oct 7 21:25 usr
    drwxr-xr-x 2 root wheel 512 Oct 7 21:25 var
    # /usr/mdec/installboot -v /altboot/boot /usr/mdec/biosboot wd1
    boot: /altboot/boot proto: /usr/mdec/biosboot device: /dev/rwd1c
    installboot: open: /altboot/boot: No such file or directory
    # file /altroot/boot
    /altroot/boot: ELF 32-bit LSB executable, Intel 80386, version 1, statically linked, stripped

    So what I did:
    # cp /altroot/boot .
    # ls -l
    total 108
    -rw-r–r– 1 root wheel 22 Mar 2 2011 .Xdefaults
    -rw-r–r– 1 root wheel 578 Mar 2 2011 .cshrc
    -rw——- 1 root wheel 125 Mar 2 2011 .klogin
    -rw-r–r– 1 root wheel 328 Mar 2 2011 .login
    -rw-r–r– 1 root wheel 468 Mar 2 2011 .profile
    -r-xr-xr-x 1 root wheel 44848 Oct 7 21:49 boot
    # file boot
    boot: ELF 32-bit LSB executable, Intel 80386, version 1, statically linked, stripped
    # /usr/mdec/installboot -v ./boot /usr/mdec/biosboot wd1
    boot: ./boot proto: /usr/mdec/biosboot device: /dev/rwd1c
    installboot: cross-device install

    After I removed wd0 to test the RAID I got an unbootable system stating the following:
    Using drive 0, partition 3.
    No O/S

    Any ideas?

    Ecstasy

    2011/10/07 at 11:07

    • Whoops! There was an error in my installboot command. That command should have been:

      /usr/mdec/installboot -v /altroot/boot /usr/mdec/biosboot wd1

      That is, it should have been /altroot/boot instead of /altboot/boot. If you mount /altroot and run the corrected installboot command it should work.

      verb

      2011/10/08 at 22:01

  2. I must’ve been blind… but that happens, when you’re on the console for 21 consecutive hours. Now it’s good :p

    Ecstasy

    2011/10/09 at 07:44

  3. […] which made this article possible: Software RAID on OpenBSD using softraid Installing OpenBSD 4.8 using softraid This entry was posted in OpenBSD by Nikola. Bookmark the […]

  4. […] which made this article possible: Software RAID on OpenBSD using softraid Installing OpenBSD 4.8 using softraid This entry was posted in General by Nikola. Bookmark the […]

  5. […] which made this article possible: Software RAID on OpenBSD using softraid Installing OpenBSD 4.8 using softraid This entry was posted in General by Nikola. Bookmark the […]

  6. […] which made this article possible: Software RAID on OpenBSD using softraid Installing OpenBSD 4.8 using softraid This entry was posted in OpenBSD by Nikola. Bookmark the […]

  7. […] Ресурси, помогнали ми за написването на статията: Software RAID on OpenBSD using softraid Installing OpenBSD 4.8 using softraid […]


Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s