Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 
share|improve this question
    
Did this recipe work? I just tried it, after trying a few of my own that were similar, and kept getting unusable recipe. I'm using jessie rc1 installer with lvm_no_boot question applied with respect to bug report mentioned below. –  umeboshi Feb 18 at 22:17
    
I removed the boot_lv, and had no problem with the install. I'm not sure the bugfix below actually works, but the only reason I had to maintain a separate boot partition was due to the bootloader not being able to access a logical volume. Since this isn't a problem anymore, I don't really need to separate /boot, at least during the installer phase. I can always do this later if I need to dual boot a machine. –  umeboshi Feb 18 at 23:10
1  
Please see my new answer below, I've opted for putting boot partition outside LVM –  Swav Feb 18 at 23:55

2 Answers 2

up vote 0 down vote accepted

After a bit of googling I found below snippet of code from partman-auto-lvm, it seems that if lvm recipe detects /boot partition on LVM it will bail out although it's perfectly possible to have /boot on LVM. According to my research, before GRUB 2 you couldn't boot from LVM so you needed separate primary boot partition.

# 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

A workaround would be to specify no mount point and do it manually from setup screens, which defeats the purpose of unattended install to some degree.

share|improve this answer
    
bugs.debian.org/cgi-bin/bugreport.cgi?bug=610377 adds partman-auto-lvm/no_boot which can be used to disable this check. –  Richard Kettlewell Dec 14 '14 at 14:40
    
As of ubuntu 14.04 it still doesn't allow a separate /boot on lvm even with partman-auto-lvm/no_boot set to false. Either keep /boot inside / or use a non-lvm /boot as per Swav's other answer. Just a warning for coming generations of preseed wrestlers. –  gnp Jul 23 at 15:10

After some trial and error I have arrived at a recipe and settings below, I've used it to succesfully preseed our servers. As it stands now, it overwrites disks without confirmation so tweak options before actually testing it out.

## Partitioning using RAID
# The method should be set to "raid".
d-i     partman-auto/method string raid
# Specify the disks to be partitioned. They will all get the same layout,
# so this will only work if the disks are the same size.
d-i     partman-auto/disk string /dev/sda /dev/sdb

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

# Next you need to specify the physical partitions that will be used. 
d-i partman-auto/expert_recipe string           \
    multiraid ::                    \
        256 512 256 raid            \
            $lvmignore{ }           \
            $primary{ }         \
            method{ raid }          \
            raidid{ 1 }         \
        .                   \
        4000 5000 -1 raid           \
            $lvmignore{ }           \
            method{ raid }          \
            raidid{ 2 }         \
        .                   \
        2000 5000 -1 ext4           \
            $defaultignore{ }       \
            $lvmok{ }           \
            method{ format }        \
            format{ }           \
            use_filesystem{ }       \
            filesystem{ ext4 }      \
            mountpoint{ / }         \
            lv_name{ root_lv }      \
        .                   \
        512 512 300% linux-swap         \
            $defaultignore{ }       \
            $lvmok{ }           \
            method{ swap }          \
            format{ }           \
            lv_name{ swap_lv }      \
        .


# Last you need to specify how the previously defined partitions will be
# used in the RAID setup. Remember to use the correct partition numbers
# for logical partitions. RAID levels 0, 1, 5, 6 and 10 are supported;
# devices are separated using "#".
# Parameters are:
# <raidtype> <devcount> <sparecount> <fstype> <mountpoint> \
#          <devices> <sparedevices>

d-i partman-auto-raid/recipe string         \
    1 2 0 ext3 /boot                \
        raidid=1                \
    .                       \
    1 2 0 lvm -                 \
        raidid=2                \
    .



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 
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.