3

So my question is, Is it possible to install the EFI partition onto both drives when doing a seed install on Ubuntu? That way if one drive goes, the relevant efi partition/data is there on the second drive, and it can just boot off that. Or is it only possible to install it to the first drive. Here's my working seed file to install it only to the first drive, setup RAID 1 and LVM. But I'd like to know how to do both

d-i     partman-md/device_remove_md                   boolean true 
d-i     partman-lvm/device_remove_lvm                 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 90%
d-i     partman-auto/expert_recipe string \
    efi-lvm ::      \
1 1 1 free            \
    $bios_boot{ }       \
    method{ biosgrub }  \
.                       \
256 10 256 fat32        \
    $primary{ }         \
    $lvmignore{ }       \
    method{ efi }       \
    format{ }           \
.\
    20000 30 1000000000 raid    \
    \$lvmignore{ }      \
    \$primary{ }        \
    method{ raid }      \
    .\
    20000 50 400000 ext4    \
    \$defaultignore{ }  \
    \$lvmok{ }      \
    lv_name{ root }     \
    method{ format }    \
    format{ }       \
    use_filesystem{ }   \
    filesystem{ ext4 }  \
    mountpoint{ / }     \
    label{ Root }       \
    .\
    2048 40 2048 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

I also have the following in ny seed file to sum up the drives and trash any lvm bits.

 d-i partman/early_command \
      string debconf-set partman-auto/disk "\$(list-devices disk | head -n1)"

d-i partman/early_command string vgs -separator=: -noheadings | cut -f1 -d: | while     read vg ; do vgchange -an \$vg ; done ; pvs -separator=: -noheadings | cut -f1 -d: |     while read pv ; do pvremove -ff -y \$pv ; done

1 Answer 1

3

Found the winning combo for my situation. This trashes all Raid/Physical Partitions/LWM, etc so the seed install starts out with a totally clean slate. Tested and confirmed on multiple boxes with multiple partition schemes in place.

# 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 | cut -f1 -d: |     while read pv ; do pvremove -ff -y \$pv ; done

d-i partman/early_command \
     string /bin/dd if=/dev/zero of=/dev/sda bs=512 count=1

d-i partman/early_command \
     string /bin/dd if=/dev/zero of=/dev/sdb bs=512 count=1

# Disk Partitioning

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 90%
d-i     partman-auto/expert_recipe string \
    efi-lvm ::      \
256 10 256 fat32        \
    \$primary{ }         \
    \$lvmignore{ }       \
    method{ efi }       \
    format{ }           \
.\
    20000 30 1000000000 raid    \
    \$lvmignore{ }      \
    \$primary{ }        \
    method{ raid }      \
    .\
    20000 50 400000 ext4    \
    \$defaultignore{ }  \
    \$lvmok{ }      \
    lv_name{ root }     \
    method{ format }    \
    format{ }       \
    use_filesystem{ }   \
    filesystem{ ext4 }  \
    mountpoint{ / }     \
    label{ Root }       \
    .\
    2048 40 2048 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    partman-md/confirm_nochanges    boolean false
d-i     partman-md/confirm_nooverwrite                boolean true
d-i     partman/confirm_nooverwrite                   boolean true
d-i     mdadm/boot_degraded             boolean true

And there you go. It creates VG-root and swap across a raid 1 partition across two disks, along with having a partition on each disk suitable for EFI. Ask any questions if you need to. I've got a better hang on this now, and can answer some relating to Ubuntu seed disk configuration on Trusty 14.04 LTS

Thanks

1
  • Just wanted to say - HUGE thanks for this! I ran into the exact same requirement recently (software RAID1 for the root partition while having cloned boot EFI partitions) - and your answer saved me heaps of time fiddling with the partman recipe.
    – V. Romanov
    Oct 18, 2016 at 12:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .