Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have been working for a while to setup RAID 1 on my fedora server. I have one installed with Fedora, 1 blank but partitioned. The one with fedora is /dev/sda and the blank one is /dev/sdb.

I tried to install by doing mdadm --create /dev/md0 --raid-devices=2 --level=1 /dev/sda2 /dev/sdb1, which it responded with the "cannot open /dev/sda: device or resource busy error."

I tried doing implementing the solution from a previous thread, where I used sudo yum remove dmraid libdmraid1.0.0.rc15 and restarted, but there was still a device busy on /dev/sda.

I tried to force it by using mdadm --assemble --run --force /dev/md0 /dev/sda2 /dev/sdb1, but it said "/dev/sda2 has no superblock - assembly aborted".

When I tried to do the zero-superblock command, mdadm --zero-superblock /dev/sda1, it returned with "couldn't open /dev/sda for write - not zeroing".

So, then I installed smartmontoools to see if it was a problem with the drive. They both passed the test when I used smartctl -d ata -a dev/sd[a1,b1,a2,b2].

I'm pretty new to Linux and Fedora in general, so maybe the solution is really easy and its slipping over my head? I'm just really confused and frustrated at this point, and I would like to seek some outside help. I have no idea where to go from here.

share|improve this question
    
RAID really should bet setup at install time, trying to configure it after the fact is a lot more difficult. If you can, it would probably be a lot easier to backup what you have now, reinstall configuring raid during the install. –  Zoredache Jul 1 at 20:43

1 Answer 1

What are you trying to do? Because I see two options:

Option 1:

You already have installed Fedora on the disk /dev/sda, on the first partition.
You have some free space in /dev/sda2
You have some free space in /dev/sdb1
And you want to combine these two partitions in a mirror.

Option 2:

You have installed Fedora on the first disk (in the first partition) and you want to mirror everything, including the OS which is currently active.


Option 1 should just work. You might want to check that the partition type of /dev/sda2 and /dev/sdb1 is fd. (Aka Linux RAID autodetect).

You also want to check that neither partition has a mounted (and thus active) filesystem. Worst case reboot the OS and select single user mode. Then create the array with nothing running but a bare root shell.


Option 2 is trickier. The easy solution is to reinstall with the RAID array create before you install.

The hard solution comes down to this:

  • Create a mirror with one disk.
    mdadm -create /dev/md0 --raid-devices=2 --level=1 missing /dev/sdb1 (note the `missing**). You should now have a degraded mirror.
  • Copy the OS to the new device. Tricky with a running OS. I recommend booting from a liveCD to do this.
  • Configure the new disk to boot (probably means playing with the bootloader).
  • Now boot from the degraded mirror leaving the old OS on sda inactive.
  • Wipe the disk, repartition to type fd. Probably reboot.
  • 'Fix' the mirror by adding the old disk to it.
share|improve this answer
    
I think the second option is what I'm trying to achieve. I tried creating the degraded mirror with that command, but it still says /dev/sdb1: device or resource busy –  Sonicarrow Jul 1 at 20:08
    
Even if you reboot and try it from runlevel 1? (If it does I am out of ideas. I have not seriously used Linux in about 6 years, though I tried to do option 2 a few months ago in a VM in order to answer a similar question over on Server Fault. I know it should work. I also know I missed something because I got stuck at moving the bootloader and root over to the array). –  Hennes Jul 1 at 20:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.