This isn’t a how to post, so much as a reminder for myself on how I was able to accomplish this. I have Debian wheezy installed on one of my SunFire V240 servers, and I didn’t setup the RAID root initially when I was tinkering around with the server. After some research and fidgeting I was able to get things working swell. Debian dropping support for SPARC is saddening, especially since I was hoping to be able to move away from Solaris a little bit and run modern Linux on my Sparc boxes. With that announcement comes something else, AFAIK (other then maybe Gentoo) there are no active Linux ports for Sparc. It’s almost like, this is the end of something great.
The disk of the current running Linux system had a partition layout like this:
/dev/sda1 0 192780 96390 1 Boot
/dev/sda2 192780 136134810 67971015 83 Linux native
/dev/sda3 0 142255575 71127787+ 5 Whole disk
/dev/sda4 136134810 142255575 3060382+ 82 Linux swap
So I used fdisk on /dev/sdb and copied the partition layout by hand. I’m sure there is really quick and easy way to do this, but it seemed faster in my case to just do it by hand. When i was done my partition setup looked like this:
Command (m for help): p
Disk /dev/sdb (Sun disk label): 255 heads, 63 sectors, 8853 cylinders
Units = sectors of 1 * 512 bytes
Device Start End Blocks Id System
/dev/sdb1 0 192780 96390 1 Boot
/dev/sdb2 192780 136134810 67971015 fd Linux raid autodetect
/dev/sdb3 0 142223445 71111722+ 5 Whole disk
/dev/sdb4 136134810 142223445 3044317+ fd Linux raid autodetect
Then I formatted the boot parition with an ext2 filesystem, and mounted it.
mkfs.ext2 /dev/sdb1
mkdir /mnt/boot-temp
mount /dev/sdb1 /mnt/boot-temp
Next, I copied files from the existing boot tree into the newly created drive
cp -r /boot/* /mnt/boot-temp/
Now we’re ready to create the RAID for the root partition. So /dev/sdb2 gets created as md0, then we create md1 for our swap:
mdadm –create /dev/md0 –level=1 –force –raid-devices=1 /dev/sdb2
mdadm –create /dev/md1 –level=1 –force –raid-devices=1 /dev/sdb4
So after that I created filesystems on the RAIDs, mounted the root raid to /mnt/root-temp, and copied the entire running root system minus the /dev and other filesystems. I used the rsync section in this tutorial I found online which worked out great: http://www.tolaris.com/2008/10/01/moving-your-linux-root-partition-to-raid/
Next, I had to chroot into the newly created RAID filesystem, I edited the fstab and /boot/silo.conf as appropriate. By the time I was finished these were my config files:
/etc/fstab:
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda2 during installation
/dev/md0 / ext4 errors=remount-ro 0 1
# /boot was on /dev/sda1 during installation
/dev/sda1 /boot ext4 defaults 0 2
# swap was on /dev/sda4 during installation
/dev/md1 none swap sw 0 0
/dev/sr0 /media/cdrom0 udf,iso9660 user,noauto 0 0
/boot/silo.conf:
root=/dev/md0
partition=1
default=DoogoKernel3
read-only
timeout=100
image=/vmlinuz
label=Linux
initrd=/initrd.img
image=/vmlinuz-3.2.511338
label=DoogoKernel2
initrd=/initrd.img-3.2.511338
image=/vmlinuz-3.2.511337
label=DoogoKernel
initrd=/initrd.img-3.2.511337
image=/vmlinuz-3.2.511339
label=DoogoKernel3
initrd=/initrd.img-3.2.511339
image=/vmlinuz.old
label=LinuxOLD
initrd=/initrd.img.old
After that, and compiling the kernel so RAID was built in, I booted off the second hard drive into my new raid system. Once the system was up successfully, I went ahead and used fdisk to change the partition types of the root and swap partition to raid. I then added them to the already running RAID.
mdadm –add /dev/md0 /dev/hda2
mdadm –add /dev/md1 /dev/hda4
mdadm /dev/md0 –grow -n 2
mdadm /dev/md1 –grow -n 2
Then I could watch /proc/mdstat and once the array was finished rebuilding, I rebooted and was pleasantly surprised to find my boot times considerably faster thanks to the RAID.
This web guide also proved to be a great resource in helping me complete my adventure, http://bragi.netprodigy.com/jeff/linux/debian-on-netra-x1-raid ..