[CentOS] CentOS 4 Software Raid1 questions

Wed Apr 27 17:08:00 UTC 2005
Les Mikesell <lesmikesell at gmail.com>

On Wed, 2005-04-27 at 10:44, Aleksandar Milivojevic wrote:

> You'd need to resize file systems after you import partitions into MD. 
> An e2fsck/resize2fs would take care of that.  Do an "fsck -f /dev/md0" 
> (for example).  It will complain that information in superblock is wrong 
> (partition size fsck sees is smaller than what it found in superblock). 
>   Just answer "no" to abort question.  After you did fsck, you need to 
> do "resize2fs /dev/md0".  Repeat for all md devices you created.
> For above, the file systems should be either unmounted, or mounted read 
> only.  The best thing to do is to boot from CD into rescue mode, and do 
> all job from it.
> The reason is that MD uses couple of last blocks for metadata 
> information, and that space is no longer usable for file system data. 
> So your /dev/md* metadisks will be slightly smaller than partitions you 
> created them on.

What happens if existing files are on these blocks before you

> When you are creating mirrors, make sure you list devices in right 
> order.  Data is always copied from first disk you specify to second 
> disk.  If you get them the wrong way around, you loose data.

Another approach that might be safer is to create a 'broken' mirror
first by specifying the 2nd device as 'missing'.  Then you can build
a filesystem on the md device and mount it somewhere and copy the
files over from the existing partition.  Then unmount the old partition,
remount the raid device in its place (adjusting /etc/fstab to match)
and use mdadm to add the old partition into the new raid, which will
hot-sync it to match the new setup.

> There are some rather good HOWTOs on this question (with much longer, 
> detailed and better descriptions of migration process).  Use the Google 
> Luke.

I looked for this and found lots of info on building RAIDs but none
about preserving an existing filesystem while converting to a mirror.
Can you provide a link or a good search term to pick that up?  Also,
I have noticed that after syncing the mirrored drives, you can split
them and mount a single drive from it into another machine without
making an md device first.  (For example, if one part is on a
USB/firewire drive, you can plug it into a different machine and mount
the /dev/sda? partition it becomes.) However, I don't know if this is
harmful or not.  Does anyone know if, after running a while in this mode
it will still work correctly if detected as an md? device (with or
without resyncing to a partner)?

  Les Mikesell
   les at futuresource.com