The Moose Moose

Moose Tail

RAID with HP Microserver and Linux Mint

Sunday 25th November 2012 - By The Moose

Well my hard drive failed after six months and has gone back to Amazon.  I bought two 3TB disks as a replacement.  Hard drive prices are so ridiculous that I wasn't going to buy anything with a higher price per gigabyte.  With stupidly high hard drive prices, faulty disks and general disgust with storage companies using their own definition of a gigabyte I'm not feeling very happy with WD and Seagate at the moment.  Having to cave-in and spend money on drives at the moment was not a good feeling. This is not retail-therapy, this is self-harming.

The problem is that 3TB disks are useless.  By the looks of things there is nothing that supports them.  There's barely a BIOS in the world that will boot from them.  Well, we'll see how I get on with them.

I bought two because I want to RAID them.  There are three ways of achieving this

  1. Do it properly
  2. Fakeraid
  3. Software RAID

I have two HP Microservers neither does RAID properly so option one is out of the question.  They do however offer FakeRaid in the BIOS so I'll configure it and see what happens.


Configure Fakeraid on an HP Microserver N40L

My machines are HP ProLiant N40L MicroServers.  You activate the RAID from the BIOS screen.  Reboot your server and press F10 when prompted.  Switch to "Advanced" then choose "IDE Configuration" The options are IDE, RAID and AHCI.  Choose RAID then save-and-reboot.

When your machine reboots you can press Ctrl-F to access the RAID configuration.  My older Microserver offers only RAID0 and RAID1.  My newer machine has a whole host of options.

I tried RAID1 with two 250GB disks and it worked well.  After booting from a Live CD the system saw both disks seperatly.  The trick is to run GParted which forces a the OS to load dmraid.  Your fakeraid will be mounted under /dev/mapper/

And it worked, seamlessly.  But the same steps with 3TB disks failed, the OS only saw the two separate disks and wouldn't mount the RAID.  It didn't matter if I booted from them or the 250MBs dmraid just refused to see the things.

Well, no-go with 3TB drives but for smaller disks it certainly wasn't a bother.  There are plenty of objections to fakeraid but it wasn't complicated.

Option 3 is to use software RAID.  This is much more complicated to set up.


Software raid wilth mdadm - HP Microserver and Linux Mint

Configuration Basics

First off I had a look at my systems support for 3TB disks.  It seems that I can boot from them up to a point.  Essentially, when they formatted as a single partition it seems to depend where GRUB is at any given time.  After an installation the system may boot.  If anything causes GRUB to be rewritten then it may stop booting.  Provided GRUB is within the first half of the disks then the system boots but if it moves to the second half then you get a GRUB: Out of disk error.

This was, I suppose, what boot partitions were invented to solve.

In the end I mounted the 250GB disks and the 3TB ones.  I'll install on the small disks and mount The Beasts as /srv or something.

The idea is to make identical partitions on both disks and not format them until they have been built into a RAID


Shopping List

So, I'm doing this...

  • Partition (Don't allow a Format)
  • Build Raid
  • Format
  • Install OS (Don't reboot)
  • Mount running environment onto new install
  • chroot
  • Install mdadm and grub
  • allow RAID to sync
  • Reboot

(I said it was a pain in the neck)



First partition your drives.  Leave one MB or so at the start of your boot disks from GRUB's boot blocks.  Remember to make identical partitions on both drives and don't format them yet.


RAID Configuration

Now do this:

sudo su
apt-get install mdadm

I have a boot partition(md0), a swap partition(md1), a main / partition(md2) and my 3TB /srv monsters(md3).  For each RAID do this sort of thing.  I'm mounting sda1 and sdb1 as md0

mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sd[ab]1


If you make a hash of it just use

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

and start again


Now we can format them, this is for ext4

mke2fs -t ext4 /dev/md0
mke2fs -t ext4 /dev/md2
mke2fs -t ext4 /dev/md3


and for the swap partition

mkswap /dev/md1


Mint Installation

Now you can run the Mint Installer just follow your nose.  When GRUB fails, choose to continue without it.


Modify installation - chroot

Now we need to chroot, the idea is to mount the current running environment onto your new installation, then we swap to that new installation so that we can modify it.

First mount the new boot partition into /boot on you new / drive.

mount /dev/md0 /dev/md2/boot

Now mount the current running state into the new root (Cribbed from here)

mount --bind /dev        /dev/md2/dev
mount --bind /dev/pts    /dev/md2/dev/pts
mount --bind /proc        /dev/md2/proc
mount --bind /sys        /dev/md2/sys
mount --bind /tmp        /dev/md2/tmp

Now we can chroot to our new /

chroot /dev/md2


Modify installation - make the changes

Install mdadm (Also from here)

apt-get install mdadm
cd /etc/mdadm
nano mdadm.conf -> delete / from array names so they should look like /dev/md0 and /dev/md1 and /dev/md2

Now install your boot partition

update-initramfs -uv
grub-install /dev/sda
grub-install /dev/sdb

(I found I needed the second update-grub)

Modify installation - leave chroot

Now you can swap back to your real root with 'exit' and undo all your mounts

umount -l /target/dev
umount -l /target/dev/pts
umount -l /target/proc
umount -l /target/sys
umount -l /target/tmp
umount -l /dev/md2/boot

To see what is going on with your mount points just enter "mount"


Allow RAID to sync before rebooting

Use this command to check your RAID state

watch -n5 cat /proc/mdstat

Once all the disks are synced you can reboot.  If all is well you should get your OS.


When things go wrong - apt-get

One word of warning.  For me - the chroot seemed to mess up apt-get a bit.  For example apt-get insists that GParted is installed when it isn't.  Don't worry, just do this

apt-get install --force-reinstall true gparted


When things go wrong - "grub rescue" prompt

If your machine doesn't boot - try this if the prompt is "grub rescue>"

First type "ls" to get a list of partitions

set prefix=(hd0,msdos6)/boot/grub
insmod normal

The exact text you type in brackets on the first line will depend on what "ls" tells you.  Just look at the output of "ls" and try a few likely looking candidates.


When things go wrong - "grub" prompt

If your machine doesn't boot and the prompt is "grub>" - you may need to load a kernel using the "linux" command (this is GRUB2)

First type 'boot' - you never know, it may work.

Then type "ls" to get a list of partitions

set root=(hd0,msdos6)
linux /vmlinuz root=/dev/sda1 ro
initrd /initrd.img

The exact text you type in brackets on the first line will depend on what "ls" tells you.  Just look at the output of "ls" and try a few likely looking candidates.


How to fix GRUB2 once and for all

If you have been having grub issues - once you have booted retry the grub installation, like this

sudo su
update-initramfs -uv
grub-install /dev/sda
grub-install /dev/sdb

Linux Mint and Debian Edition

Sunday 25th November 2012 - By The Moose

After much thought I switched from Linux Mint Debian Edition to Maya LTS.  Debian Edition is based on Debian Testing and even though I wasn't doing anything special I was running into problems - apache failing randomly for example.  The idea of never having to reinstall sounds nice but always running testing versions isn't worth it.  Linux Mint Maya is supported until 2017, by then the server will be due a reinstall, I think.

I wrote out my live CD with UNetbootin - that worked nicely.  The "Distribution" section was well out-of-date but I chose "Diskimage" and browsed for the Mint ISO and all was well.

By the way- the real reason for this reinstall was a hard drive failure.  Always good fun those are.


Wednesday 26th October 2011 - By The Moose

One of the first things I installed on my home server was Dnsmasq.  It's a DHCP/DNS/TFTP combo service created especially to configure small networks.  It is easy enough for a muppet like me to configure and has loads of options designed with home networks in mind.  The config file is full of useful comments, examples and advice.  It comes in the standard Ubuntu and Mint repositories - you can in stall it with "sudo apt-get install dnsmasq"

Configuring Dnsmasq is easy - just edit /etc/dnsmaq.conf.  Each option is described, you just need to read the file from top to bottom and uncomment where necessary.  Provided your configuration is fairly standard you won't even need to change many values from the default.  There are some great options like "filterwin2k" to filter some of the junk coming from Windows boxes.  There are some wonderful examples to uncomment such as the one to block the

The nice thing about Dnsmasq is that it will include all locally connected machines into its DNS table and will cache all the requests that are forwarded to external DNS servers.  The only difficult decision to make is whether or not you want your server to use its own DNS service.  This makes sense but by default Dnsmasq gets its list of DNS servers from resolv.conf so there is only the one list.  There seem to be various ways to manipulate but I decided I'd rather have two files anyway.  I just copied resolv.conf to dnsmasq-resolv.conf and added "resolv-file=/etc/dnsmasq-resolv.conf" to my Dnsmasq config file.  You can then change your resolv.conf file to contain just

Once you have your server configured with Samba you can start pushing a WINS configuration to the Windows boxes on your network.  You need to uncomment some of the dhcp-option lines that handily ship in the default config file.  I uncommented options 19, 44, 45 and 46.  Like this

dhcp-option=19,0    # option ip-forwarding off
dhcp-option=44,    # set netbios-over-TCP/IP nameserver(s) aka WINS server(s)
dhcp-option=45,    # netbios datagram distribution server
dhcp-option=46,8    # netbios node type

Which makes browsing the network from Windows clients much, much faster.

A server at last

Friday 16th September 2011 - By The Moose

Well, I finally bought a server.  It’s an HP ProLiant MicroServer - it was dirt cheap and I assumed it would be a bit of a joke.  Actually, I’m impressed.

It seems to me that this thing is a perfect home server.  It’s fast enough.  It draws about 30watts; I’m perfectly happy to leave it on all day.  Yet despite its size it’s a real server at heart.

The server came with 1GB of RAM and a single puny hard drive.   It’s got two memory slots, 4 HD bays and 1 for a CD drive.  It also has tonnes of USB sockets – 4 on the front, two at the back and 1 inside.

I bought another 4GB of RAM for mine; funds won’t stretch to SpinPoints at the moment so I’ve no idea how easy it is to configure a RAID on the thing.  The RAM upgrade was easy enough.  The machine is cramped inside and I found unplugging all the leads was fiddly.  Once everything is disconnected you can pull the motherboard straight out the front of the cabinet and put it onto your workbench.  After that the upgrade is simple – except for plugging everything back in of course.

I installed desktop Linux Mint on my server and it runs beautifully.  If it had a sound card I’d say this thing would be a perfectly decent desktop.

I chose the CD ISO of Linux Mint Gnome V11 64bit and installed it onto a RAM stick using Universal USB Installer.  Once this was plugged into the front of the server it booted just fine.  Using the USB pen drive to install Mint onto the server's hard drive was uneventful.

After the first boot there was an error message but an online update sorted that out.  After the online update I upgraded to the DVD distribution using the Codecs and DVD options on the Mint Welcome Screen. 

The server is an AMD machine and has an ATI chipset.  Mint automatically pulled in the drivers - no problem.

Dual booting Linux without changing your Windows 7 disk

Thursday 11th August 2011 - By The Moose

Dual booting GRUB4DOS via the Windows 7 boot manager

Dual booting Windows 7 is rather more of a pain in the neck because BOOT.INI has disapeared in that OS.

You need to use the bcdedit DOS command to create a new menu entry.

bcdedit /create /d "Linux" /application BOOTSECTOR
bcdedit /set {id} device boot
bcdedit /set {id} path \grldr.mbr bcdedit /displayorder {id} /addlast

Then to finish up you need to copy grldr.mbr, grldr and menu.lst to the root of C:

For more information about GRUB4DOS see my other post.