md raid on Debian – setting timeout before assembling an array

I have one pretty old Debian Squeeze Linux server with SCSI and SATA drives. Root partition is mirrored between them using mdraid. The problem was that after reboot array always was in “degraded” state with only ATA disk in it.

Of course it was possible to manually re-add SCSI drive using “mdadm -a” command aft, but it was causing RAID rebuild process (and a lot of I/O next ~30 minutes). So, i decided to find a cause.  After analyzing dmesg it was found that “/dev/sda” (SATA) is appearing on 3rd second and “/dev/sdb” -on ~15, after slow initialization of SCSI controller. The problem is that mdadm is trying to assemble RAID before sdb is available and ready. After finding the reason fix was trivial:

  1. I copied /usr/share/initramfs-tools/scripts/local-top/mdadm script to the /etc/initramfs-tools/scripts/local-top directory.
  2. In /etc/initramfs-tools/scripts/local-top/mdadm file, after line:
    verbose && log_begin_msg "Assembling all MD arrays"
    line
    sleep 15
  3. Run “update-initramfs -u” and reboot.

After reboot array was in consistent state, so problem is resolved.

Advertisements
Tagged , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: