Comments on How To Set Up Software RAID1 On A Running System (Incl. GRUB2 Configuration) (Debian Squeeze)

How To Set Up Software RAID1 On A Running System (Incl. GRUB2 Configuration) (Debian Squeeze) This guide explains how to set up software RAID1 on an already running Debian Squeeze system. The GRUB2 bootloader will be configured in such a way that the system will still be able to boot if one of the hard drives fails (no matter which one).

10 Comment(s)

Add comment

Please register in our forum first to comment.

Comments

By: al biheiri

Why would you modprobe multipath? I think that is only used for fiber cards. It shouldnt have anything to do with mdadm.

By: paul

Hey.

Great Tutorial! 

Here are a couple of bumps you might run into, if you're trying to use this on Debian Unstable "Wheezy". 
 
 

First
If you want to use GPT enabled harddisks you'll have to create a small (1MB) BIOS Boot Partition or GRUB2 won't install on that drive. 
 
 

Second
If you ARE actually using GUID partition tables you won't be able to change your partitions using fdisk. You'll have to use gdisk (or parted) instead, which is its direct successor and fairly simple to use. Note however, that there's no direct way of duplicating the partition table from one disk to another. You'll have to use sgdisk for that, which installs with gdisk: 
sgdisk --replicate=/dev/sdb /dev/sda

sgdisk --randomize-guids --move-second-header /dev/sdb
The second line is important to distinguish the disks in your system later on. In addition it ensures that your Secondary (Backup) GPT Header really resides on the very last blocks of your disk.
 
 

Third:
This one took me a while :-\
If you're creating the ''/etc/grub.d/09_swraid1_setup'' as mentioned you MUST rename the module GRUB2 is instructed to load from
 
insmod mdraid to insmod mdraid1x

 

(at least for a RAID1 or 10 configuration), as the old-named module does no longer exist. Furthermore, if you don't have a separated /boot/partition you need to fix the path to the kernel and ramdisk (probably "/boot/vmlinuz-2.6…" and "/boot/initrd.img-2.6…"

By: Anonymous

How can I do this on Debian 7? Now I've killed 6 VMs with this Turorial :D

By: Simon

Thanks for this tutorial. I had a much simpler task of just putting /home in raid 1. I followed this minus the grub stuff since I was not including a bootable partition in the array and it was very helpful.

By: timinski

This line is rights restricted on my running system:

vi /etc/mtab

I can open and edit the file but not save it. From what I understand, mtab is symlink of /proc/self/mounts.  What are the steps required to save the changes on a live system?

By: Andrey

> Now I've killed 6 VMs with this Turorial

 

No wonder, really.

Tutorial is not only extremely badly written, even worse: it suggests making destructive changes to the system boot process.

 

All you need to migrate living system to the RAID is:

1. Add enough disks.

2. Create raid partitions on these newly added disks.

3. Assemble arrays with "missing" parts.

4. Format the arrays into chosen FS.

5. Copy (cp --preserve=all) everything to the respective arrays.

6. Install grub to raid. (grub-install --recheck --no-floppy /dev/md0)

Some operations may require to boot from LiveCD.

 

What to scatter through four pages? I don't see.

By: Raf

 Based in your config and your failure scenario, is it possible to replace sda without  put /dev/sdb in /dev/sda's place and connect the new HDD as /dev/sdb!)?.

 For example, keeping your config (a closer to real life scenario): sda fails, you must reboot the system (for any reason) but you are not able to change sdb to sda connection and get a new replacement disk so you need to reboot with a faulty sda and a working sdb in a degradated md0. What's the best way to handle your grub config, considering it's pointing to sda (md/0 or hd0,1)

By: Edder

For Debian 8 I had to run dpkg-reconfigure mdadm to get RAID support into initrd.

By: rocky

Great tutorial.  I got RAID working in a couple of days.  What held me up was the outdated modulees.  I loaded mdraid1x instead of raid and mdraid and it all just worked!

By: Alexander

I was able to use this to move Debian 10.4 to RAID1, with the following amendments:in grub menuentry had replace insmod raid insmod mdraidwith insmod mdraid1xand /etc/mtab were not save-able, but w/o editing it the guide still seem to workas for /boot/vmlinuzyou possibly did cp -dpRx /boot /mnt/md2which created /boot subfolder inside /bootcd /boot followed by cp -dpRx . /mnt/md2 is in the guide for that reason