Preseeding Ubuntu partman recipe using LVM and RAID

Posted by Swav on Server Fault See other posts from Server Fault or by Swav
Published on 2013-11-01T09:19:49Z Indexed on 2013/11/01 9:58 UTC
Read the original article Hit count: 362

Filed under:
|
|
|
|

I'm trying to preseed Ubuntu 12.04 server installation and created a recipe that would create RAID 1 on 2 drives and then partition that using LVM. Unfortunately partman complains when creating LVM volumes saying there no partitions in recipe that could be used with LVM (in console it complains about unusable recipe).

The layout I'm after is RAID 1 on sdb and sdc (installing from USB stick so it takes sda) and then use LVM to create boot, root and swap.

The odd thing is that if I change the mount point of boot_lv to home the recipe works fine (apart from mounting in wrong place), but when mounting at /boot it fails

I know I could use separate /boot primary partition, but can anybody tell me why it fails. Recipe and relevant options below.

## Partitioning using RAID
d-i     partman-auto/disk string /dev/sdb /dev/sdc
d-i     partman-auto/method string raid
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-lvm/new_vg_name string main_vg
d-i partman-auto/expert_recipe string           \
    multiraid ::                    \
        100 512 -1 raid         \
            $lvmignore{ }           \
            $primary{ }         \
            method{ raid }          \
        .                   \
        256 512 256 ext3            \
            $defaultignore{ }       \
            $lvmok{ }           \
            method{ format }        \
            format{ }           \
            use_filesystem{ }       \
            filesystem{ ext3 }      \
            mountpoint{ /boot }     \
            lv_name{ boot_lv }      \
        .                   \
        2000 5000 -1 ext4           \
            $defaultignore{ }       \
            $lvmok{ }           \
            method{ format }        \
            format{ }           \
            use_filesystem{ }       \
            filesystem{ ext4 }      \
            mountpoint{ / }         \
            lv_name{ root_lv }      \
        .                   \
        64 512 300% linux-swap          \
            $defaultignore{ }       \
            $lvmok{ }           \
            method{ swap }          \
            format{ }           \
            lv_name{ swap_lv }      \
        .

d-i partman-auto-raid/recipe string \
    1 2 0 lvm -                     \
          /dev/sdb1#/dev/sdc1       \
    .                               
d-i     mdadm/boot_degraded boolean true
#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 

EDIT:

After a bit of googling I found below snippet of code from partman-auto-lvm, but I still don't understand why would they prevent that setup if it's possible to do manually and booting from boot partition on LVM is possible.

# Make sure a boot partition isn't marked as lvmok
if echo "$scheme" | grep lvmok | grep -q "[[:space:]]/boot[[:space:]]"; then
     bail_out unusable_recipe
fi

© Server Fault or respective owner

Related posts about ubuntu

Related posts about raid