Software RAID1 on Debian(Squeeze) GRUB2 and GPT drives

Discussion in 'HOWTO-Related Questions' started by mccyberix, Oct 11, 2011.

  1. mccyberix

    mccyberix Member

    hi folx,
    I've tried to setup a sw RAID1 on a Debian(squeeze) box using two 2TB GPT drives following the corresponding tutorial but with no luck. I have to do some minor changes since the tutorial does not cover the use of GPT drives. Here is what I've done different as suggested:

    "sgdisk --replicate=/dev/sdb /dev/sda" (I've used this to copy the partition tables)

    "sgdisk --randomize-guids --move-second-header /dev/sdb" (and this to randomize the GUID)

    and finally I renamed the mdraid module to mdraid1x in "09_swraid1_setup"

    except this I have exactly followed the tutorial and all went fine until the step where I have to "mdadm --add /dev/md1 /dev/sda3". It always drops the error "cannot open /dev/sda3 device or resource is busy" md1 is my actual mounted "/" and sda3 was the "/" before I booted with md1. I am also able to skip that step and going to the end of the tutorial but when I do this my md1 has only one drive. I also checked what is occupying my sda3 device and saw that "jbd2" was running on that device. So I've really tried everything that was on my mind but no chance to release the sda3 and add it to the md1 array. I also have tried to recreate the sda3 partition and delete the data on it but then my system won't boot anymore, IMHO the system is still using the sda3 and not only md1 as it should.
    I hope somebody can help me out I'm slowly getting mad with this since I'm sitting the whole week trying/failing and goggling without success.

    thx in advance
  2. mccyberix

    mccyberix Member

    I have lost my patience...

    I have to build up my system as soon as possible so I decided to make the RAID1 on a fresh install which is pretty straight forward. I'm not sure if the partman(standard partitioning tool invoked during debian setup) can create GPT, in my case it didn't, therefore I used gdisk or similar to create the GPT table on every disk which I want to use in the array (fdisk cannot handle the GPT). If you proceed building up your RAID1 based on MBR instead of GPT you won't be able to install GRUB2, this is really annoying since installing GRUB2 is almost the last step in the installation process. To be able to boot from any device of your array you just have to install GRUB2 on each of it using this command

    grub-install /dev/sdb
    grub-install /dev/sdc
    grub-install /dev/sdd...

    I know this is not an option for people who need to make RAID1 on a running system but in my case it was easier to build up the whole system on a fresh install then getting RAID1 on a running system.

    have a nice day!

Share This Page