Affichage des articles dont le libellé est OpenBSD. Afficher tous les articles
Affichage des articles dont le libellé est OpenBSD. Afficher tous les articles

lundi, mars 19, 2012

OpenBSD 5.1 installation on softraid(4)

OpenBSD 5.1 brings new cool features like this one:

"boot(8/amd64) is teached how to access softraid(4) volumes, which allows a kernel to be loaded from a softraid RAID 1 volume. Furthermore it is sufficient to only boot from a disk that is a member of a bootable softraid volume, as this case will be detected and the boot will automatically be redirected to sr[0-9]a:/bsd."

This mean that the bootloader can boot directly from a softraid(4) partition: No more "standard" partitions needed with kernel copied on them on both hard drive!


Here is how to proceed:
During your CD-ROM boot, check that you have a minimum of 2 hard drives detected:
CD-ROM: E0
Loading /5.1/AMD64/CDBOOT
probing: pc0 com0 mem[639K 126M a20=on]
disk: hd0+* hd1+* cd0
>> OpenBSD/amd64 CDBOOT 3.16
boot>

Continue the boot process and select to launch a shell:


Welcome to the OpenBSD/amd64 5.1 installation program.
(I)nstall, (U)pgrade or (S)hell? s

Display the names of the disks detected by OpenBSD:


# sysctl hw.disknames
hw.disknames=wd0:7922594e8158ee03,wd1:49129150e28daf19,cd0:,rd0:7c8ac10ea613493f

On this example (Virtualbox VM), we've got 2 SATA hard-drives: wd0 and wd1 (cd0 is the CD-ROM and rd0 is the RAM drive created by the kernel).
By default OpenBSD create only one /dev for the first hard drive, we need to create a second and initialize a MBR to them:

# cd /dev/
# sh MAKEDEV wd1
# fdisk -iy wd0
Writing MBR at offset 0.
# fdisk -iy wd1
Writing MBR at offset 0.

Now, we need to create a BSD label named "raid" to both disks.
We will create a BSD label for the first drive, and dump/restore the label table to the second drive:

# disklabel -E wd0
Label editor (enter '?' for help at any prompt)
> a a
offset: [64]
size: [20964761]
FS type: [4.2BSD] raid
> q
Write new label?: [y] 
# disklabel wd0 > protofile
# disklabel -R wd1 protofile


Now we can create a softraid(4) volume using the two "a" partitions :

# bioctl -c 1 -l wd0a,wd1a softraid0 
sd0 at scsibus1 targ 1 lun 0: SCSI2 0/direct fixed
sd0: 10236MB, 512 bytes/sector, 20964233 sectors
softraid0: SR RAID 1 volume attached as sd0

This will create a new drive: sd0 in this example.
Return back to the OpenBSD installer (Ctrl+D), and select this new softraid disk for the destination root disk:

# ^D
erase ^?, werase ^W, kill ^U, intr ^C, status ^T

Welcome to the OpenBSD/amd64 5.1 installation program.
(I)nstall, (U)pgrade or (S)hell? i

(etc...)

Available disks are: wd0 wd1 sd0.
Which one is the root disk? (or 'done') [wd0] sd0

Once installed, simply reboot and enjoy:


>> OpenBSD/amd64 BOOT 3.18
boot>
booting sr0a:/bsd: 5648376+1600524+932384+0+616448 [89+497880+322605]=0xd2d0a8
entry point at 0x1001e0 [7205c766, 34000004, 24448b12, ccb8a304]
(etc...)
sd0 at scsibus2 targ 1 lun 0: SCSI2 0/direct fixed
sd0: 10236MB, 512 bytes/sector, 20964233 sectors
root on sd0a (f7748118e1f577a4.a) swap on sd0b dump on sd0b
Automatic boot in progress: starting file system checks.
(etc...)