How Would I go about (in a snippet) creating a recipe/snippet that creates two raid/pv/lv off of two disks?  Basically I want it to look like this:


/dev/sda (800gb)
---200GB Raid-1/PV-root/LV-root  =/dev/md0
---600GB Raid-1/PV-wite/LV-write =/dev/md1
/dev/sdb (800GB)
---200GB Raid/PV-root/LV-Root/Raid 1 =/dev/mdo
---600GB Raid-1/PV-write/LV-write =/dev/md1

FYi, we're using software raid, but I'm only wanting to utilize the first two disks for the raid volumes, and have two raid "partitions" created, along with 2 PV's and 2 LV's, so we have a /dev/md0 bootable drive that's 200GB and a "write" drive that's 600GB and /dev/md1.


I have no problem doing this manually through the installer, just wondering how to automate it?  Whenever I automate it, it allocates all 800GB on each disk for RAID 1, and just created a /dev/md0.

Here's my current snippet: (which I know is wrong)

# Disk Partitioning
# Use LVM, and wipe out anything that already exists
d-i partman/early_command string vgs --separator=: --noheadings | cut -f1 -d: |
while read vg ; do vgchange -an \$vg ; done ; pvs --separator=: --noheadings | c
ut -f1 -d: | while read pv ; do pvremove -ff -y \$pv ; done; mdadm --stop --forc
e /dev/md*; /bin/dd if=/dev/zero of=/dev/sda bs=512 count=1; /bin/dd if=/dev/zer
o of=/dev/sdb bs=512 count=1; /bin/dd if=/dev/zero of=/dev/sdc bs=512 count=1; /
bin/dd if=/dev/zero of=/dev/sdd bs=512 count=1; /bin/dd if=/dev/zero of=/dev/sde
 bs=512 count=1; /bin/dd if=/dev/zero of=/dev/sdf bs=512 count=1; /bin/dd if=/de
v/zero of=/dev/sdg bs=512 count=1; /bin/dd if=/dev/zero of=/dev/sdh bs=512 count
=1;


# Disk Partitioning

d-i     partman-basicfilesystems/choose_label         string gpt
d-i     partman-basicfilesystems/default_label        string gpt
d-i     partman-partitioning/choose_label             string gpt
d-i     partman-partitioning/default_label            string gpt
d-i     partman/choose_label                          string gpt
d-i     partman/default_label                         string gpt
d-i     partman-lvm/device_remove_lvm                 boolean true
d-i     partman-md/device_remove_md                   boolean true
d-i     partman-lvm/confirm                           boolean true
d-i     partman-auto/disk                             string /dev/sda /dev/sdb
d-i     partman-auto/method                           string raid
d-i     partman-auto-lvm/new_vg_name                  string vg0
d-i     partman-auto-lvm/guided_size                  string 50%
d-i     partman-auto/expert_recipe string \
efi-lvm :: \
        256 10 256 free        \
         \$iflabel{ gpt } \
        method{ biosgrub } \
        \$primary{ }         \
        \$lvmignore{ }       \
         format{ }           \
.\
50% 30 50% raid \
       \$gptonly{ } \
\$lvmignore{ } \
\$primary{ } \
method{ raid } \
.\
140000 50 140000 ext4 \
\$defaultignore{ } \
\$lvmok{ } \
lv_name{ root }   \
method{ format } \
format{ } \
use_filesystem{ } \
filesystem{ ext4 } \
mountpoint{ / } \
label{ Root } \
.\
6000 40 6000 swap \
\$defaultignore{ } \
\$lvmok{ } \
lv_name{ swap } \
method{ swap } \
format{ } \
.

d-i     partman-auto-raid/recipe string \
1 2 0 lvm - /dev/sda2#/dev/sdb2  \
.
d-i     partman-md/confirm                            boolean true

d-i     partman-partitioning/confirm_write_new_label  boolean true
d-i     partman/choose_partition                      select Finish partitioning
 and write changes to disk
d-i     partman/confirm                               boolean true
d-i     partman-md/confirm_nooverwrite                boolean true
d-i     partman/confirm_nooverwrite                   boolean true
d-i     mdadm/boot_degraded boolean true




Any help?

This is on Ubuntu Trusty 14.04

--

Jen