SPARC, Linux, RAID1, SILO


 
Thread Tools Search this Thread
Operating Systems Linux SPARC, Linux, RAID1, SILO
# 1  
Old 07-29-2010
SPARC, Linux, RAID1, SILO

Hi,

I've been searching for answers for two days and didn't find any definite answers on building RAID1 on SPARC. The main problem was with SILO (Sparc Improved boot LOader): can it boot from RAID partition or not. So I just tried it and it works.
I've done this on Debian, but it should be applicable to all Linux distributions.

Setup RAID1 on T5220 with 2 disks /dev/sda and /dev/sdb.

Here's the setup:

Currently only /dev/sda is active and sliced into 3 partitions:
/dev/sda1 is /boot (ext2)
/dev/sda2 is / (ext3)
/dev/sda4 is swap

/dev/sda3 only marks the whole disk. Like c partition on BSD.

/boot has ext2 since the installation. I really don't know why, but I'm keeping it.

First thing's first: compile support for RAID in the kernel (modules won't do)!
Second: using fdisk, change id of all the partitions you would like to add to RAID array to Linux raid autodetect (fd).

Copy the partition table to the next disk:
Code:
$ sudo dd if=/dev/sda of=/dev/sdb bs=512 count=1

$ sudo fdisk -l /dev/sda

Disk /dev/sda (Sun disk label): 255 heads, 63 sectors, 17848 cylinders
Units = cylinders of 16065 * 512 bytes

   Device Flag    Start       End    Blocks   Id  System
/dev/sda1             0        12     96390   fd  Linux raid autodetect
/dev/sda2            12     17088 137162970   fd  Linux raid autodetect
/dev/sda3             0     17848 143364060    5  Whole disk
/dev/sda4         17088     17848   6104700   fd  Linux raid autodetect

$ sudo fdisk -l /dev/sdb

Disk /dev/sdb (Sun disk label): 255 heads, 63 sectors, 17848 cylinders
Units = cylinders of 16065 * 512 bytes

   Device Flag    Start       End    Blocks   Id  System
/dev/sdb1             0        12     96390   fd  Linux raid autodetect
/dev/sdb2            12     17088 137162970   fd  Linux raid autodetect
/dev/sdb3             0     17848 143364060    5  Whole disk
/dev/sdb4         17088     17848   6104700   fd  Linux raid autodetect

Using mdadm, create md devices with only one member!
Code:
$ sudo mdadm -C /dev/md0 -l 1 -n 2 missing /dev/sdb1
$ sudo mdadm -C /dev/md1 -l 1 -n 2 missing /dev/sdb2
$ sudo mdadm -C /dev/md2 -l 1 -n 2 missing /dev/sdb4

NOTE:
When creating md devices, it is wiser to name them the same as the disk devices are named, so that, for example, md2 includes sda2 and sdb2, md3 includes sda3 and sdb3 and so on. That removes the possible brain damage when adding more than 3 partitions in RAID.

Create filesystem on md0 and md1:
Code:
$ sudo mkfs -t ext2 /dev/md0
$ sudo mkfs -t ext3 /dev/md1

Mount both devices and copy data:
Code:
$ sudo mkdir /mnt/md0 /mnt/md1
$ sudo mount /dev/md0 /mnt/md0
$ sudo mount /dev/md1 /mnt/md1

$ sudo rsync -auHxv /boot/* /mnt/md0
$ sudo rsync -auHxv --exclude=/proc/* --exclude=/sys/* --exclude=/mnt/* /* /mnt/md1

$ for i in /mnt/md*; do
> sudo umount $i
> done

Unmount /boot and add the device to /dev/md0 and unswap /dev/sda4 and add it to /dev/md2:
Code:
$ sudo umount /boot
$ sudo mdadm /dev/md0 -a /dev/sda1
$ sudo mount /dev/md0 /boot

$ sudo swapoff /dev/sda4
$ sudo mdadm /dev/md2 -a /dev/sda4
$ sudo mkswap /dev/md2
$ sudo swapon /dev/md2

Edit /etc/fstab and replace /dev/sda devices with /dev/md:
Code:
$ cat /etc/fstab
# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0
#/dev/sda2       /               ext3    errors=remount-ro 0       1
#/dev/sda1       /boot           ext2    defaults        0       2
#/dev/sda4       none            swap    sw              0       0
/dev/scd0       /media/cdrom0   udf,iso9660 user,noauto     0       0

/dev/md0       /boot           ext2    defaults        0       2
/dev/md1       /               ext3    errors=remount-ro 0       1
/dev/md2       none            swap    sw              0       0

Edit silo.conf and replace only root option from:

root=/dev/sda2
to
root=/dev/md1

Everything else stays the same:
Code:
$ cat /boot/silo.conf 
root=/dev/md1
partition=1
default=Linux
read-only
timeout=100

image=/vmlinuz
        label=Linux
        initrd=/initrd.img

Create mdamd.conf from mdadm output:
Code:
$ sudo mdadm --detail --scan > /tmp/mdadm.conf && sudo mv /tmp/mdadm.conf /etc/mdadm/mdadm.conf
$ cat /etc/mdadm/mdadm.conf
ARRAY /dev/md1 level=raid1 num-devices=2 metadata=00.90 UUID=1e0247b6:38abf547:5dec9e91:f507770d
ARRAY /dev/md0 level=raid1 num-devices=2 metadata=00.90 UUID=8a086292:710ef67f:5dec9e91:f507770d
ARRAY /dev/md2 level=raid1 num-devices=2 metadata=00.90 UUID=c78000c5:1a4d6dc4:9ee3339d:45c4c887

NOTE:
Perhaps even better method for creating mdamd.conf would be by using --examine instead of --detail, which doesn't include metadata information and removes occasional error regarding metadata version.

Reboot. After the system boots, add the remaining /dev/sda2 (ex root) to /dev/md1.
Wait for the devices to sync and you are finished.
Code:
$ sudo mdadm /dev/md1 -a /dev/sda2

At any point you can examine status of your RAID by reading /proc/mdstat:
Code:
$ cat /proc/mdstat 
Personalities : [linear] [raid0] [raid1] [multipath] [raid6] [raid5] [raid4] 
md2 : active raid1 sda4[0] sdb4[1]
      6104576 blocks [2/2] [UU]
      
md0 : active raid1 sda1[1] sdb1[0]
      96320 blocks [2/2] [UU]
      
md1 : active raid1 sda2[1] sdb2[0]
      137162880 blocks [2/2] [UU]
      
unused devices: <none>

That's it. OS boots from RAID partition. I even unplugged the disk to see the effects and it holds and boots. The only thing left was to force Linux to rescan the SCSI controller for devices once the removed disk was reinserted. This was done with a simple shell script:
Code:
#!/bin/sh

for i in /sys/class/scsi_host/host*; do
        echo "- - -" > ${i}/scan
done

Any comments and/or questions are welcome.

Last edited by Luka; 08-04-2010 at 01:56 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Red Hat

Migrating Oracle on Solaris Sparc to Linux RHEL 7 VM

Hi Gurus, We are migrating Oracle from Solaris to RHEL 7 and looking for Solaris equivalent commands for Linux. we are using lot of korn shell scripts built on Solaris so, i am looking for equivalent commands which are using in Solaris.. Could you please help me here by proving any info ... (4 Replies)
Discussion started by: mssprince
4 Replies

2. Shell Programming and Scripting

Migrating Oracle on Solaris Sparc to Linux RHEL 7 VM

Hi Gurus, We are migrating Oracle from Solaris to RHEL 7 and looking for Solaris equivalent commands for Linux. we are using lot of korn shell scripts built on Solaris so, i am looking for equivalent commands which are using in Solaris.. Could you please help me here by proving any info... (1 Reply)
Discussion started by: mssprince
1 Replies

3. Solaris

Moving to RAID1

Is there an easy, safe way to move the system to RAID1 on sparc solaris 10? (without reinstalling). thanks. (6 Replies)
Discussion started by: orange47
6 Replies

4. Linux

Oracle Linux on SPARC

Hi Oracle Linux users, You can probably guess from the title what the question is: Does anyone know if Oracle Linux (the Unbreakable variety I think that is) comes in a SPARC release or, if not, will there be one some time soon ? Many thanks, P;):D:b: (2 Replies)
Discussion started by: patcom
2 Replies

5. UNIX Desktop Questions & Answers

Use Sparc HD in Linux PC?

My Sparc 10 is not working and I would like to get some data file from it. Can I use Sparc HD as an external HD to a linux PC? If I do, dies linux PC will recognize this HD and not ask to format it? Thanks a lot. :confused: (5 Replies)
Discussion started by: cc878
5 Replies

6. Solaris

RAID1 and LDoms

I have a Netra T5220 Solaris 10 server with LDoms installed and enabled. RAID1 is enabled in the control domain with the following slices: d50 -m d51 d52 1 d51 1 1 c1t0d0s5 d52 1 1 c1t1d0s5 d10 -m d11 d12 1 d11 1 1 c1t0d0s0 d12 1 1 c1t1d0s0 d20 -m d21 d22 1 d21 1 1 c1t0d0s1 d22 1 1... (14 Replies)
Discussion started by: StarSol
14 Replies

7. Ubuntu

Ubuntu for SPARC: Linux freezes (ALOT!)

Hi, I am wanting to get some input on an issue that I have encountered with Ubuntu 7.10 Gutsy. When installing Linux & booting Linux it freezes almost all the time, I don't know if it is the shell or whatever, but after SILO, it goes wild of freezes, then rebooting all the time. (The display... (0 Replies)
Discussion started by: huffandy
0 Replies

8. Solaris

How can I mount a ufs filesystem on a solaris 10 sparc onto a Linux server

Hi there, I am trying to mount a SAN volume (which is mapped to solaris sparc) partitioned with ufs filesystem onto a linux (intel processor 64bit) server. *I have re-compiled the linux kernel t support ufs fstype with ro mount support. filesystem on solaris:... (3 Replies)
Discussion started by: ilan
3 Replies

9. Programming

C compiler to build Sparc/Solaris binaries on Linux

Just that the Subject says. I am looking for a C compiler for Linux x86 that will allow me to compile a C source code file and the resulting binary will be able to run on a Sparc running Solaris. Thanks. (2 Replies)
Discussion started by: lyonsd
2 Replies
Login or Register to Ask a Question