Presuming you're trying to rebuild as in restore redundancy to an array that has lost one disk
- If the array is not already assembled, assemble it:
mdadm --assemble --scan /dev/md1 (if it's in the config file) or
mdadm --assemble /dev/md1 /dev/sda2 /dev/sdb2 /dev/sdc2 /dev/sdd2. If one of the disks has failed, just leave it off the line.
- If the rebuild was needed because because of an unclean shutdown, etc. it should happen automatically now. You can watch the status by
cat /proc/mdstat. NOTE: If it says its in 'auto read-only mode', you need to write the the array (mounting the filesystem surely will), or use
mdadm -w /dev/md1 to get it to start.
- If the rebuild is because of a failed disk, add the replacement disk to the array:
mdadm -a /dev/md1 /dev/sde2 (
sde2 being the new disk). You might have to do
mdadm --run /dev/md1 as well.
If by "rebuild" you mean recover from something that is supposed to be fatal to RAID5 (e.g., double-disk failure), then that's more complicated, and the steps depend on exactly what lead up to the failure.