Ubuntu 10.04/GRUB2 mdadm won't boot

Moving to RAID was a pain.
What you have to do is the following from an existing install:

Install mdadm


Create your mdadm RAID 1 array on your spare hard drive.
Start it with the missing disk.

rsync the entire contents of your current / to the md partition.

Here's a good way of doing it:

rsync -Pha --exclude=/proc/* --exclude=/sys/* --exclude=/mnt/* /. /mnt/md2

"/mnt/md2" is the mount point of the md array I want to boot from.

*Note the "/." at the end, the . makes sure that all hidden files will be copied (weirdly enough rsync and other commands will IGNORE and NOT copy hidden files without specifying the .)  Do not specify a ".*", bad and unexpected things copy/happen when you do that.

chroot into your mdadm partition:

mount -o bind /proc /mnt/$path/proc
mount -o bind /dev/ mnt/$path/dev
mount -o bind /sys /mnt/$path/sys
chroot /mnt/$path

You'll need to setup /etc/mdadm/mdadm.conf

sudo mdadm --detail --brief /dev/md0 >> /etc/mdadm/mdadm.conf

You'll need to install grub on the actual hard drive

Use the correct device name for your RAID drives (for me it is sdb and sda).

*Note it's not the actual device such as /dev/sda1, it's just the drive device name alone (GRUB 2 does the rest by default).


grub-install /dev/sdb

grub-install /dev/sda

We run "update-grub" so that the UUID for your mdadm RAID array is specified when booting (otherwise booting will fail and you'll be frustrated/stressed out-that's how this guide was created).

update-grub

Update your initramfs with "update-initramfs -u".
exit chroot
unmount your /mnt/$path/*

reboot and it should work.

*Often it seems initramfs does not get mdadm added to it UNLESS mdadm is freshly installed in the chroot environment.  To be sure remove mdadm and then reinstall it and that should make 100% mdadm is added.  Just running update-initramfs has not always worked for me.

*One problem I had is that at one point my OS install called my md0 /dev/md_d0 for some reason.  Even so my /etc/mdadm/mdadm.conf referred to it as md0.  Yet grub set the root as being "root=md_d0" and this caused booting/mounting to fail until I set it back to "root=UUID=".

 


Tags:

ubuntu, grub, mdadm, bootmoving, raid, existing, install, array, disk, rsync, contents, md, partition, pha, exclude, proc, sys, mnt, quot, mount, copied, weirdly, commands, specifying, specify, chroot, bind, dev, ll, etc, conf, sudo, sdb, sda, default, update, uuid, specified, booting, frustrated, stressed, initramfs, unmount, reboot, freshly, installed, reinstall, os, md_d, referred, mounting,

Latest Articles

  • How To Add Windows 7 8 10 11 to GRUB Boot List Dual Booting
  • How to configure OpenDKIM on Linux with Postfix and setup bind zonefile
  • Debian Ubuntu 10/11/12 Linux how to get tftpd-hpa server setup tutorial
  • efibootmgr: option requires an argument -- 'd' efibootmgr version 15 grub-install.real: error: efibootmgr failed to register the boot entry: Operation not permitted.
  • Apache Error Won't start SSL Cert Issue Solution Unable to configure verify locations for client authentication SSL Library Error: 151441510 error:0906D066:PEM routines:PEM_read_bio:bad end line SSL Library Error: 185090057 error:0B084009:x509 certif
  • Linux Debian Mint Ubuntu Bridge br0 gets random IP
  • redis requirements
  • How to kill a docker swarm
  • docker swarm silly issues
  • isc-dhcp-server dhcpd how to get longer lease
  • nvidia cannot resume from sleep Comm: nvidia-sleep.sh Tainted: Linux Ubuntu Mint Debian
  • zfs and LUKS how to recover in Linux
  • [error] (28)No space left on device: Cannot create SSLMutex Apache Solution Linux CentOS Ubuntu Debian Mint
  • Save money on bandwidth by disabling reflective rpc queries in Linux CentOS RHEL Ubuntu Debian
  • How to access a disk with bad superblock Linux Ubuntu Debian Redhat CentOS ext3 ext4
  • ImageMagick error convert solution - convert-im6.q16: cache resources exhausted
  • PTY allocation request failed on channel 0 solution
  • docker error not supported as upperdir failed to start daemon: error initializing graphdriver: driver not supported
  • Migrated Linux Ubuntu Mint not starting services due to broken /var/run and dbus - Failed to connect to bus: No such file or directory solution
  • qemu-system-x86_64: Initialization of device ide-hd failed: Failed to get