Installing Vyatta 6.6 R1 with software raid 1

vyatta_logo

Intro

For all my routers I usually choose at least some level of raid. As routers usually don’t need any disk performance, simple raid 1 – mirroring is enough to sustain disk failure and ensure server continues to work. Now let’s get busy and install our latest Vyatta on our server.

Prerequisites

To ensure fast boot up, disable your floppy device in BIOS, since Vyatta has big problems booting up if it recognises fd0.

Setting up raid

Let’s set up our raid. First boot up your Vyatta from USB or CD and let’s get busy.

Become root and remove any possible existing raid entries.

sudo su
mdadm --zero-superblock /dev/sda /dev/sdb

Setup one partition, to install Vyatta (It’s just no use complicating too much with more partitions). In my case I used all space on the device and as you can see start up from clean disk without partitions.

[email protected]:/home/vyatta# fdisk /dev/sda
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').
         
Command (m for help): p

Disk /dev/sda: 400.1 GB, 400088457216 bytes
255 heads, 63 sectors/track, 48641 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000a7a3a

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-48641, default 1):[enter]
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-48641, default 48641):[enter]
Using default value 48641

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

Repeat the same procedure for sdb. Let’s create our md0 raid now.

mdadm --create --verbose /dev/md0 --level=mirror --raid-devices=2 /dev/sda1 /dev/sdb1
Installing system

Okay now we have our raid 1 array md0 and we can proceed with installation. I use system installation over image install. Image install only creates /boot, then stores everything in images… I’m a bit sceptical about that. I prefer having normal linux installation, so I can manipulate with it using rescue disk’s etc.

install system

There we go, few basic questions to answer and we’re finished. Almost.

Postinstallation

Reboot without CD/USB will fail. You don’t have properly installed grub and it will just hang, no matter if Vyatta says it’s all finished successfully. It’s a bug in Vyatta. To fix it, let’s just boot up from our medium again and type few commands more to get it working.

sudo su
mkdir /mnt/vyatta
mount /dev/md0 /mnt/vyatta
mount -o bind /dev /mnt/vyatta/dev
mount -t proc none /mnt/vyatta/proc
mount -t sysfs none /mnt/vyatta/sys
chroot /mnt/vyatta /bin/bash

Now we’re in chrooted environment of our vyatta. We can now do rescan of our raid device and install grub appropriately on both disks.

mdadm --examine --scan >> /etc/mdadm/mdadm.conf
update-grub
grub-install /dev/sda
grub-install /dev/sdb

This should do the trick. Optionally, make sure /dev/disk/by-uuid/ UUID of md0 matches the UUID from /boot/grub/grub.cfg and /etc/fstab. Now reboot and remove your installation medium to see if everything worked well.

Notes

Don’t use GPT partition tables while creating raid partitions, becouse Vyatta’s installation might run into problems. At least I ran into problems and Vyatta wouldn’t install correctly. To erase your GPT tables back to “normal” you should use command parted /dev/sda and then type: mktable then for type, enter msdos You can then simply setup partitions with fdisk again.

Leave a Reply

help-hint.png
Purpose of the commenting system is to share your experience. I encourage you to post feedback with your own suggestions, ideas or optimizations regarding the topic of a blog post. What commenting system isn't for, is asking questions about similar issues of yours and requesting support for it. Blog post is provided as is and I am not here to solve all your problems. Please bear that in mind and try to avoid posting such comments. I do take privilege to remove comment from my blog for any reason whatsoever. Usually I do it when I sense a comment was posted only for spam/seo reasons or is out of blog post's topic. Thank you for reading this, now you may continue :)
 

Your email address will not be published. Required fields are marked *