Skip to contentSkip to conversation

mdadm help and howto for newbies?

DISCUSSION Stephen Lee 2 participants 3 messages Apr 19, 2002 MD RAID

lore
Share & tools
lore
#0 lore raw

Hi,

Is there a Howto for mdadm newbies? The Software raid Howto is too old to reference mdadm. I have some questions on how to proceed:

1. Do I need to mark my raid1 partitions with the type fd?
2. I tried:
mdadm -C /dev/md0 --level raid1 --raid-disks 2 /dev/hda1 missing and got the message:
md: can not import hda1, has active inodes!
md: error, md_import_device() returned -16
Does this mean that the partitions to be added to /dev/md0 must be unmounted?
3. If #2 is yes then how do I convert my partitions to raid1? In using raidtools, I simply copied the live drive contents to a spare drive with "fd" type partitions and followed the instructions in the Boot+Root+Raid+LILO Howto.
4. Is it possible to boot root raid1 with mdadm and no autodetect?

I am running kernel 2.4.18 with raid1 compiled in.

Thanks for your help,
Stephen

#1 lore raw
Quoted 3 lines · On April 19, [email protected] wrote:

Hi,

Is there a Howto for mdadm newbies? The Software raid Howto is too old

I don't know of any.

Quoted 3 lines

to reference mdadm. I have some questions on how to proceed:

1. Do I need to mark my raid1 partitions with the type fd?

Only if you want to use autodetect. I don't.

Quoted 7 lines

2. I tried:
mdadm -C /dev/md0 --level raid1 --raid-disks 2 /dev/hda1 missing and got the message:
md: can not import hda1, has active inodes!
md: error, md_import_device() returned -16
Does this mean that the partitions to be added to /dev/md0 must be unmounted?

Yes, definately. Once a partition has beein included into an md array, md *must* be the only thing accessing that partition, otherwise confusion can result.

Quoted 4 lines

3. If #2 is yes then how do I convert my partitions to raid1? In using raidtools, I simply copied the live drive contents to a spare drive with "fd" type partitions and followed the instructions in the Boot+Root+Raid+LILO Howto.

Support /dev/hda1 was your live boot drive, and /dev/hdc1 was second partition that you eventually wanted to raid1 together with /dev/hda1. Then
1/ create a degraded raid1 using /dev/hdc1 only:

     mdadm -C /dev/md0 --level raid1 --raid-disks 2 missing /dev/hdc1
  2/ create a filesystem on /dev/md0 and mount it:
     mkfs /dev/md0
     mount /dev/md0 /mnt
  3/ copy everything from / to /mnt
      cp -ax / /mnt
    could do it.
  4/ modify /mnt/etc/fstab to think that / is on /dev/md0
  5/ reboot with a kernel-parameter of:
        md=0,/dev/hdc1 root=/dev/md0
  6/ If this all seems to work properly, then add /dev/hda1 to the
     raid1 array:
       mdadm /dev/md0 -a /dev/hda1
     and change the kernel-paramter line to
        md=0,/dev/hda1,/dev/hdc1 root=/dev/md0
Quoted 1 line

4. Is it possible to boot root raid1 with mdadm and no autodetect?

See above.

NeilBrown

#2 lore raw
Quoted 27 lines · Neil Brown
Quoted 2 lines · On April 19, [email protected] wrote:

1. Do I need to mark my raid1 partitions with the type fd?

Only if you want to use autodetect. I don't.

Quoted 7 lines

2. I tried:
mdadm -C /dev/md0 --level raid1 --raid-disks 2 /dev/hda1 missing and got the message:
md: can not import hda1, has active inodes!
md: error, md_import_device() returned -16
Does this mean that the partitions to be added to /dev/md0 must be unmounted?

Yes, definately. Once a partition has beein included into an md array, md *must* be the only thing accessing that partition, otherwise confusion can result.

Quoted 4 lines

3. If #2 is yes then how do I convert my partitions to raid1? In using raidtools, I simply copied the live drive contents to a spare drive with "fd" type partitions and followed the instructions in the Boot+Root+Raid+LILO Howto.

Support /dev/hda1 was your live boot drive, and /dev/hdc1 was second partition that you eventually wanted to raid1 together with /dev/hda1. Then
1/ create a degraded raid1 using /dev/hdc1 only:

Quoted 16 lines
     mdadm -C /dev/md0 --level raid1 --raid-disks 2 missing /dev/hdc1
  2/ create a filesystem on /dev/md0 and mount it:
     mkfs /dev/md0
     mount /dev/md0 /mnt
  3/ copy everything from / to /mnt
      cp -ax / /mnt
    could do it.
  4/ modify /mnt/etc/fstab to think that / is on /dev/md0
  5/ reboot with a kernel-parameter of:
        md=0,/dev/hdc1 root=/dev/md0
  6/ If this all seems to work properly, then add /dev/hda1 to the
     raid1 array:
       mdadm /dev/md0 -a /dev/hda1
     and change the kernel-paramter line to
        md=0,/dev/hda1,/dev/hdc1 root=/dev/md0

Thank you Neil!

May I suggest you include the above as an example of how to convert to raid1 in your package documentation? To keep your job simple, you could simply cut and paste list messages into a faq sheet.

Stephen