reusing existing RAIDs on preseeded installation

Solution 1:

There are some late_command examples in the Ubuntu Forums, the proposed example is based on one. But first, two points:

1) Automating an install that forces formatting of one file system while preserving another is inherently dangerous. If you don't back up before proceeding, you will lose data. "Maybe not today. Maybe not tomorrow, but soon, and for the rest of your life." ;-)

2) Recreating /dev/md2 is actually the safest part. That's an mdadm mirror RAID, your data is intact barring two simultaneous hard drive failures.

Anyway, you should be able to do something like this to get /dev/md2 rebuilt & mounted where you want it:

d-i preseed/late_command string \
in-target sed 's/^ARRAY/#&/g' -i /etc/mdadm/mdadm.conf; \
in-target mdadm --detail --scan >> /etc/mdadm/mdadm.conf; \
in-target mkdir /md2; \
in-target echo '/dev/md2  /md2  ext3  defaults 0 0' >>/etc/fstab;

I will test my solution & add a comment with my results, I'm working on preseed configs for 14.04 LTS right now.