[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: raid question



On Sun, Aug 17, 2003 at 01:19:04PM +0200, Rudy Gevaert wrote:
> Hello,
> 
> I was wondering can I set up raid when a partition is mounted?
> e.g.  hda3 is /home and I want to set up raid1 with hdc3.  

If what you want to do is mirror an existing hard drive or
partition, then yes, it's possible.  Just last night I started
the process and am about halfway through.  For an idea of what to
expect, check out my log at:

    http://www.whatever.ca/index.php?m=200308#134

I'm not done yet; I still have to test booting off the mirrored
drive before I can wipe my primary drive and establish a fully
redundant mirror.  I'm hoping to be finished later today.

The key is that you want to create your RAID1 array in "degraded"
mode so that it's happy with just one disk/partition, then copy
your data over.  When you're satisfied that the data has been
copied accurately, nuke the source partition (in your case
/dev/hda3) and hotadd /dev/hda3 to the mirror.

I found the following document to be quite useful; if you ignore
the PA-RISC specific references, it walks through the process
quite nicely:

    http://www.parisc-linux.org/faq/raidboot-howto.html

This document (Boot+Root+Raid+Lilo: Software Raid HOWTO) is the
best one I've found that describes the process, but I don't think
it uses the current toolset:

    http://www.linuxdocs.org/HOWTOs/Boot+Root+Raid+LILO-4.html

I'm using mdadm, which I believe has replaced raidtools and
raidtools2 in functionality.  Perhaps I'm wrong on that aspect,
but I do know that you must create the array in "degraded" mode,
so that it doesn't put a nice fresh empty copy of /dev/hdc3 on
top of /dev/hda3.

> Can I run mkraid when hda3 is in use?  I would use the following
> raidtab:
>
> raiddev /dev/md0
>         raid-level      1
>         nr-raid-disks   2
>         nr-spare-disks  0
>         chunk-size      4
>         persistent-superblock 0
>         device          /dev/hda3
>         raid-disk       0
>         device          /dev/hdc3
>         raid-disk       1
> 
> Also, would I lose data?  When happens if I change the above order?

According to the Boot+Root+Raid+Lilo: Software Raid HOWTO, you
should have /dev/hdc3 first, otherwise you'll have trouble
booting, and instead of calling it a "raid-disk" you'll call
/dev/hda3 a "failed-disk" to exclude it from reconstruction.

I've done this once before and didn't lose any data, but I
generally recommend having a full backup before playing fast and
loose with this sort of thing.

Good luck!

-- 

Shaun Crossley
mailto:shaun@whatever.ca
http://www.whatever.ca



Reply to: