How to configure RAID + 2 LVM volumes via preseed?












4















Internally, we use Ubuntu (14.04 Trusty) on our workstations, and until now we've done all of our builds by hand, including the creation of RAID/LVM/LUKS-encrypted volumes. This doesn't scale, and I'm now working to automate some of our processes to reduce the amount of "hands on" involvement required to build a fresh workstation.



Our hard disk configuration is as follows:




  • /dev/sda & /dev/sdb are both 1Tb Hard Disks partitioned identically and RAIDed

    • 1Gb Partition with RAID 1 containing ext4 filesystem mounted as /boot

    • Remainder of drive RAID 1 containing a LVM PV/VG (vg_raid)

      • 8Gb LV for swap space

      • Remainder of space - LV containing ext4 filesystem mounted as /





  • /dev/sdc 128Gb SSD

    • Single partition containing a LVM PV/VG (vg_ssd)

    • Single LV using all available space containing an ext4 filesystem which is mounted at /ssd




Partitioned in this way we have a large, redundant, root filesystem for general data storage, and a smaller partition on which files which are I/O speed sensitive can be placed (e.g. MySQL databases).



I'm trying to replicate this in a partman expert_recipe with related configuration so that it can be created by the Ubuntu installer. My main issue is that there doesn't seem to be a (working?) mechanism in the partman recipe "language" to specify that a specific LV needs to be created in a specific colume group, and which LVM physical volumes are assigned to each volume group. I had an earlier version of this configuration working without trying to partition/format/mount any volumes on /dev/sdc, but as soon as the extra "non-RAID" drive is involved, I can't seem to express what I want in the partman recipe.



The relevant portion of my preseed.cfg file is as follows:



d-i partman-auto/disk string /dev/sda /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-lvm/confirm_nooverwrite boolean true
d-i partman-auto-lvm/new_vg_name string vg_raid vg_ssd
d-i partman-auto-lvm/guided_size string max
d-i partman-auto/expert_recipe string
boot-root ::
512 10 1024 raid
$primary{ } $lvmignore{ } $bootable{ }
method{ raid }
device{ /dev/sda /dev/sdb }
vg_name{ vg_raid }
.
4096 20 -1 raid
$primary{ } $lvmignore{ }
method{ raid }
device{ /dev/sda /dev/sdb }
.
2048 20 -1 lvm
$primary{ }
$defaultignore{ }
method{ lvm }
device{ /dev/sdc }
vg_name{ vg_ssd }
.
8192 100 -1 ext4
$defaultignore $lvmok{ }
in_vg{ vg_raid }
lv_name{ lv_root }
method{ format } format{ }
use_filesystem{ } filesystem{ ext4 }
mountpoint{ / }
device{ /dev/sda /dev/sdb }
.
4096 100 100% linux-swap
$defaultignore $lvmok{ }
in_vg{ vg_raid }
lv_name{ lv_swap }
method{ swap } format{ }
device{ /dev/sda /dev/sdb }
.
2048 100 -1 ext4
$defaultignore $lvmok{ }
method{ format } format{ }
use_filesystem{ } filesystem{ ext4 }
device{ /dev/sdc }
in_vg{ vg_ssd }
lv_name{ lv_ssd }
mountpoint{ /ssd }
.
d-i partman-auto-raid/recipe string
1 2 0 ext4 /boot /dev/sda1#/dev/sdb1 .
1 2 0 lvm - /dev/sda2#/dev/sdb2 .
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman-lvm/confirm boolean true
d-i partman-md/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
d-i partman-md/confirm_nooverwrite boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
d-i partman/mount_style select label


You'll note that I've tried to be quite specific about which partitions/volumes are to be placed on which disks, but partman doesn't seem to honor at least some of that configuration. I've also kept the minimum volume sizes fairly small while I test this configuration on a VM. When I run an install with this configuration onto a VirtualBox VM with smaller drives, the install fails with the error message:



Error while setting up RAID
An unexpected error occurred while setting up a preseeded RAID configuration.

Check /var/log/syslog or see virtual console 4 for the details.


The relevant section from syslog is as follows:



Jan 13 02:41:54 md-devices: mdadm: No arrays found in config file or automatically
Jan 13 02:41:54 partman: No matching physical volumes found
Jan 13 02:41:54 partman: Reading all physical volumes. This may take a while...
Jan 13 02:41:54 partman:
Jan 13 02:41:54 partman: No volume groups found
Jan 13 02:41:54 partman:
Jan 13 02:41:54 partman-lvm:
Jan 13 02:41:54 partman-lvm: No volume groups found
Jan 13 02:41:54 partman-lvm:
Jan 13 02:41:56 partman-auto: Available disk space (4294) too small for expert recipe (4608); skipping
Jan 13 02:41:57 kernel: [ 91.295036] Adding 2095100k swap on /dev/sdc5. Priority:-1 extents:1 across:2095100k FS
Jan 13 02:41:57 partman: mke2fs 1.42.9 (4-Feb-2014)
Jan 13 02:41:57 apt-install: Queueing package mdadm for later installation
Jan 13 02:41:57 partman-auto-raid: Error: No recipe specified in partman-auto-raid/recipe


I suspect the line 4th from the bottom is most relevant, as you can see that partman has gone ahead and created swap space on /dev/sdc, which wasn't what I wanted.



I've tried a number of variations of how partitions are specified. I've Googled a lot for versions terms relating to partman recipes and preseed in general, and I can't find a canonical reference for the different configuration options in a recipe and why they're applicable. I've found a number of RAID examples, and many LVM examples, but nothing that mixes the two in the way I'm trying to use them. This thread from the debian-user mailing list suggests that what I want to do isn't possible, and that seem to track with my impression that the partman recipe language doesn't have the tools required to describe what I'm trying to acheive.



If anyone can point out what I'm doing wrong with my configuration, or even just some good reference materials on partman expert_recipe and the configuration language involved, that'd be most appreciated. At this point it looks like I can automate my entire install, except for the partitioning portion, which is really the main thing I wanted to automate!










share|improve this question
















bumped to the homepage by Community 12 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.




















    4















    Internally, we use Ubuntu (14.04 Trusty) on our workstations, and until now we've done all of our builds by hand, including the creation of RAID/LVM/LUKS-encrypted volumes. This doesn't scale, and I'm now working to automate some of our processes to reduce the amount of "hands on" involvement required to build a fresh workstation.



    Our hard disk configuration is as follows:




    • /dev/sda & /dev/sdb are both 1Tb Hard Disks partitioned identically and RAIDed

      • 1Gb Partition with RAID 1 containing ext4 filesystem mounted as /boot

      • Remainder of drive RAID 1 containing a LVM PV/VG (vg_raid)

        • 8Gb LV for swap space

        • Remainder of space - LV containing ext4 filesystem mounted as /





    • /dev/sdc 128Gb SSD

      • Single partition containing a LVM PV/VG (vg_ssd)

      • Single LV using all available space containing an ext4 filesystem which is mounted at /ssd




    Partitioned in this way we have a large, redundant, root filesystem for general data storage, and a smaller partition on which files which are I/O speed sensitive can be placed (e.g. MySQL databases).



    I'm trying to replicate this in a partman expert_recipe with related configuration so that it can be created by the Ubuntu installer. My main issue is that there doesn't seem to be a (working?) mechanism in the partman recipe "language" to specify that a specific LV needs to be created in a specific colume group, and which LVM physical volumes are assigned to each volume group. I had an earlier version of this configuration working without trying to partition/format/mount any volumes on /dev/sdc, but as soon as the extra "non-RAID" drive is involved, I can't seem to express what I want in the partman recipe.



    The relevant portion of my preseed.cfg file is as follows:



    d-i partman-auto/disk string /dev/sda /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-lvm/confirm_nooverwrite boolean true
    d-i partman-auto-lvm/new_vg_name string vg_raid vg_ssd
    d-i partman-auto-lvm/guided_size string max
    d-i partman-auto/expert_recipe string
    boot-root ::
    512 10 1024 raid
    $primary{ } $lvmignore{ } $bootable{ }
    method{ raid }
    device{ /dev/sda /dev/sdb }
    vg_name{ vg_raid }
    .
    4096 20 -1 raid
    $primary{ } $lvmignore{ }
    method{ raid }
    device{ /dev/sda /dev/sdb }
    .
    2048 20 -1 lvm
    $primary{ }
    $defaultignore{ }
    method{ lvm }
    device{ /dev/sdc }
    vg_name{ vg_ssd }
    .
    8192 100 -1 ext4
    $defaultignore $lvmok{ }
    in_vg{ vg_raid }
    lv_name{ lv_root }
    method{ format } format{ }
    use_filesystem{ } filesystem{ ext4 }
    mountpoint{ / }
    device{ /dev/sda /dev/sdb }
    .
    4096 100 100% linux-swap
    $defaultignore $lvmok{ }
    in_vg{ vg_raid }
    lv_name{ lv_swap }
    method{ swap } format{ }
    device{ /dev/sda /dev/sdb }
    .
    2048 100 -1 ext4
    $defaultignore $lvmok{ }
    method{ format } format{ }
    use_filesystem{ } filesystem{ ext4 }
    device{ /dev/sdc }
    in_vg{ vg_ssd }
    lv_name{ lv_ssd }
    mountpoint{ /ssd }
    .
    d-i partman-auto-raid/recipe string
    1 2 0 ext4 /boot /dev/sda1#/dev/sdb1 .
    1 2 0 lvm - /dev/sda2#/dev/sdb2 .
    d-i partman-partitioning/confirm_write_new_label boolean true
    d-i partman/choose_partition select finish
    d-i partman/confirm boolean true
    d-i partman-lvm/confirm boolean true
    d-i partman-md/confirm boolean true
    d-i partman/confirm_nooverwrite boolean true
    d-i partman-md/confirm_nooverwrite boolean true
    d-i partman-lvm/confirm_nooverwrite boolean true
    d-i partman/mount_style select label


    You'll note that I've tried to be quite specific about which partitions/volumes are to be placed on which disks, but partman doesn't seem to honor at least some of that configuration. I've also kept the minimum volume sizes fairly small while I test this configuration on a VM. When I run an install with this configuration onto a VirtualBox VM with smaller drives, the install fails with the error message:



    Error while setting up RAID
    An unexpected error occurred while setting up a preseeded RAID configuration.

    Check /var/log/syslog or see virtual console 4 for the details.


    The relevant section from syslog is as follows:



    Jan 13 02:41:54 md-devices: mdadm: No arrays found in config file or automatically
    Jan 13 02:41:54 partman: No matching physical volumes found
    Jan 13 02:41:54 partman: Reading all physical volumes. This may take a while...
    Jan 13 02:41:54 partman:
    Jan 13 02:41:54 partman: No volume groups found
    Jan 13 02:41:54 partman:
    Jan 13 02:41:54 partman-lvm:
    Jan 13 02:41:54 partman-lvm: No volume groups found
    Jan 13 02:41:54 partman-lvm:
    Jan 13 02:41:56 partman-auto: Available disk space (4294) too small for expert recipe (4608); skipping
    Jan 13 02:41:57 kernel: [ 91.295036] Adding 2095100k swap on /dev/sdc5. Priority:-1 extents:1 across:2095100k FS
    Jan 13 02:41:57 partman: mke2fs 1.42.9 (4-Feb-2014)
    Jan 13 02:41:57 apt-install: Queueing package mdadm for later installation
    Jan 13 02:41:57 partman-auto-raid: Error: No recipe specified in partman-auto-raid/recipe


    I suspect the line 4th from the bottom is most relevant, as you can see that partman has gone ahead and created swap space on /dev/sdc, which wasn't what I wanted.



    I've tried a number of variations of how partitions are specified. I've Googled a lot for versions terms relating to partman recipes and preseed in general, and I can't find a canonical reference for the different configuration options in a recipe and why they're applicable. I've found a number of RAID examples, and many LVM examples, but nothing that mixes the two in the way I'm trying to use them. This thread from the debian-user mailing list suggests that what I want to do isn't possible, and that seem to track with my impression that the partman recipe language doesn't have the tools required to describe what I'm trying to acheive.



    If anyone can point out what I'm doing wrong with my configuration, or even just some good reference materials on partman expert_recipe and the configuration language involved, that'd be most appreciated. At this point it looks like I can automate my entire install, except for the partitioning portion, which is really the main thing I wanted to automate!










    share|improve this question
















    bumped to the homepage by Community 12 mins ago


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.


















      4












      4








      4








      Internally, we use Ubuntu (14.04 Trusty) on our workstations, and until now we've done all of our builds by hand, including the creation of RAID/LVM/LUKS-encrypted volumes. This doesn't scale, and I'm now working to automate some of our processes to reduce the amount of "hands on" involvement required to build a fresh workstation.



      Our hard disk configuration is as follows:




      • /dev/sda & /dev/sdb are both 1Tb Hard Disks partitioned identically and RAIDed

        • 1Gb Partition with RAID 1 containing ext4 filesystem mounted as /boot

        • Remainder of drive RAID 1 containing a LVM PV/VG (vg_raid)

          • 8Gb LV for swap space

          • Remainder of space - LV containing ext4 filesystem mounted as /





      • /dev/sdc 128Gb SSD

        • Single partition containing a LVM PV/VG (vg_ssd)

        • Single LV using all available space containing an ext4 filesystem which is mounted at /ssd




      Partitioned in this way we have a large, redundant, root filesystem for general data storage, and a smaller partition on which files which are I/O speed sensitive can be placed (e.g. MySQL databases).



      I'm trying to replicate this in a partman expert_recipe with related configuration so that it can be created by the Ubuntu installer. My main issue is that there doesn't seem to be a (working?) mechanism in the partman recipe "language" to specify that a specific LV needs to be created in a specific colume group, and which LVM physical volumes are assigned to each volume group. I had an earlier version of this configuration working without trying to partition/format/mount any volumes on /dev/sdc, but as soon as the extra "non-RAID" drive is involved, I can't seem to express what I want in the partman recipe.



      The relevant portion of my preseed.cfg file is as follows:



      d-i partman-auto/disk string /dev/sda /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-lvm/confirm_nooverwrite boolean true
      d-i partman-auto-lvm/new_vg_name string vg_raid vg_ssd
      d-i partman-auto-lvm/guided_size string max
      d-i partman-auto/expert_recipe string
      boot-root ::
      512 10 1024 raid
      $primary{ } $lvmignore{ } $bootable{ }
      method{ raid }
      device{ /dev/sda /dev/sdb }
      vg_name{ vg_raid }
      .
      4096 20 -1 raid
      $primary{ } $lvmignore{ }
      method{ raid }
      device{ /dev/sda /dev/sdb }
      .
      2048 20 -1 lvm
      $primary{ }
      $defaultignore{ }
      method{ lvm }
      device{ /dev/sdc }
      vg_name{ vg_ssd }
      .
      8192 100 -1 ext4
      $defaultignore $lvmok{ }
      in_vg{ vg_raid }
      lv_name{ lv_root }
      method{ format } format{ }
      use_filesystem{ } filesystem{ ext4 }
      mountpoint{ / }
      device{ /dev/sda /dev/sdb }
      .
      4096 100 100% linux-swap
      $defaultignore $lvmok{ }
      in_vg{ vg_raid }
      lv_name{ lv_swap }
      method{ swap } format{ }
      device{ /dev/sda /dev/sdb }
      .
      2048 100 -1 ext4
      $defaultignore $lvmok{ }
      method{ format } format{ }
      use_filesystem{ } filesystem{ ext4 }
      device{ /dev/sdc }
      in_vg{ vg_ssd }
      lv_name{ lv_ssd }
      mountpoint{ /ssd }
      .
      d-i partman-auto-raid/recipe string
      1 2 0 ext4 /boot /dev/sda1#/dev/sdb1 .
      1 2 0 lvm - /dev/sda2#/dev/sdb2 .
      d-i partman-partitioning/confirm_write_new_label boolean true
      d-i partman/choose_partition select finish
      d-i partman/confirm boolean true
      d-i partman-lvm/confirm boolean true
      d-i partman-md/confirm boolean true
      d-i partman/confirm_nooverwrite boolean true
      d-i partman-md/confirm_nooverwrite boolean true
      d-i partman-lvm/confirm_nooverwrite boolean true
      d-i partman/mount_style select label


      You'll note that I've tried to be quite specific about which partitions/volumes are to be placed on which disks, but partman doesn't seem to honor at least some of that configuration. I've also kept the minimum volume sizes fairly small while I test this configuration on a VM. When I run an install with this configuration onto a VirtualBox VM with smaller drives, the install fails with the error message:



      Error while setting up RAID
      An unexpected error occurred while setting up a preseeded RAID configuration.

      Check /var/log/syslog or see virtual console 4 for the details.


      The relevant section from syslog is as follows:



      Jan 13 02:41:54 md-devices: mdadm: No arrays found in config file or automatically
      Jan 13 02:41:54 partman: No matching physical volumes found
      Jan 13 02:41:54 partman: Reading all physical volumes. This may take a while...
      Jan 13 02:41:54 partman:
      Jan 13 02:41:54 partman: No volume groups found
      Jan 13 02:41:54 partman:
      Jan 13 02:41:54 partman-lvm:
      Jan 13 02:41:54 partman-lvm: No volume groups found
      Jan 13 02:41:54 partman-lvm:
      Jan 13 02:41:56 partman-auto: Available disk space (4294) too small for expert recipe (4608); skipping
      Jan 13 02:41:57 kernel: [ 91.295036] Adding 2095100k swap on /dev/sdc5. Priority:-1 extents:1 across:2095100k FS
      Jan 13 02:41:57 partman: mke2fs 1.42.9 (4-Feb-2014)
      Jan 13 02:41:57 apt-install: Queueing package mdadm for later installation
      Jan 13 02:41:57 partman-auto-raid: Error: No recipe specified in partman-auto-raid/recipe


      I suspect the line 4th from the bottom is most relevant, as you can see that partman has gone ahead and created swap space on /dev/sdc, which wasn't what I wanted.



      I've tried a number of variations of how partitions are specified. I've Googled a lot for versions terms relating to partman recipes and preseed in general, and I can't find a canonical reference for the different configuration options in a recipe and why they're applicable. I've found a number of RAID examples, and many LVM examples, but nothing that mixes the two in the way I'm trying to use them. This thread from the debian-user mailing list suggests that what I want to do isn't possible, and that seem to track with my impression that the partman recipe language doesn't have the tools required to describe what I'm trying to acheive.



      If anyone can point out what I'm doing wrong with my configuration, or even just some good reference materials on partman expert_recipe and the configuration language involved, that'd be most appreciated. At this point it looks like I can automate my entire install, except for the partitioning portion, which is really the main thing I wanted to automate!










      share|improve this question
















      Internally, we use Ubuntu (14.04 Trusty) on our workstations, and until now we've done all of our builds by hand, including the creation of RAID/LVM/LUKS-encrypted volumes. This doesn't scale, and I'm now working to automate some of our processes to reduce the amount of "hands on" involvement required to build a fresh workstation.



      Our hard disk configuration is as follows:




      • /dev/sda & /dev/sdb are both 1Tb Hard Disks partitioned identically and RAIDed

        • 1Gb Partition with RAID 1 containing ext4 filesystem mounted as /boot

        • Remainder of drive RAID 1 containing a LVM PV/VG (vg_raid)

          • 8Gb LV for swap space

          • Remainder of space - LV containing ext4 filesystem mounted as /





      • /dev/sdc 128Gb SSD

        • Single partition containing a LVM PV/VG (vg_ssd)

        • Single LV using all available space containing an ext4 filesystem which is mounted at /ssd




      Partitioned in this way we have a large, redundant, root filesystem for general data storage, and a smaller partition on which files which are I/O speed sensitive can be placed (e.g. MySQL databases).



      I'm trying to replicate this in a partman expert_recipe with related configuration so that it can be created by the Ubuntu installer. My main issue is that there doesn't seem to be a (working?) mechanism in the partman recipe "language" to specify that a specific LV needs to be created in a specific colume group, and which LVM physical volumes are assigned to each volume group. I had an earlier version of this configuration working without trying to partition/format/mount any volumes on /dev/sdc, but as soon as the extra "non-RAID" drive is involved, I can't seem to express what I want in the partman recipe.



      The relevant portion of my preseed.cfg file is as follows:



      d-i partman-auto/disk string /dev/sda /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-lvm/confirm_nooverwrite boolean true
      d-i partman-auto-lvm/new_vg_name string vg_raid vg_ssd
      d-i partman-auto-lvm/guided_size string max
      d-i partman-auto/expert_recipe string
      boot-root ::
      512 10 1024 raid
      $primary{ } $lvmignore{ } $bootable{ }
      method{ raid }
      device{ /dev/sda /dev/sdb }
      vg_name{ vg_raid }
      .
      4096 20 -1 raid
      $primary{ } $lvmignore{ }
      method{ raid }
      device{ /dev/sda /dev/sdb }
      .
      2048 20 -1 lvm
      $primary{ }
      $defaultignore{ }
      method{ lvm }
      device{ /dev/sdc }
      vg_name{ vg_ssd }
      .
      8192 100 -1 ext4
      $defaultignore $lvmok{ }
      in_vg{ vg_raid }
      lv_name{ lv_root }
      method{ format } format{ }
      use_filesystem{ } filesystem{ ext4 }
      mountpoint{ / }
      device{ /dev/sda /dev/sdb }
      .
      4096 100 100% linux-swap
      $defaultignore $lvmok{ }
      in_vg{ vg_raid }
      lv_name{ lv_swap }
      method{ swap } format{ }
      device{ /dev/sda /dev/sdb }
      .
      2048 100 -1 ext4
      $defaultignore $lvmok{ }
      method{ format } format{ }
      use_filesystem{ } filesystem{ ext4 }
      device{ /dev/sdc }
      in_vg{ vg_ssd }
      lv_name{ lv_ssd }
      mountpoint{ /ssd }
      .
      d-i partman-auto-raid/recipe string
      1 2 0 ext4 /boot /dev/sda1#/dev/sdb1 .
      1 2 0 lvm - /dev/sda2#/dev/sdb2 .
      d-i partman-partitioning/confirm_write_new_label boolean true
      d-i partman/choose_partition select finish
      d-i partman/confirm boolean true
      d-i partman-lvm/confirm boolean true
      d-i partman-md/confirm boolean true
      d-i partman/confirm_nooverwrite boolean true
      d-i partman-md/confirm_nooverwrite boolean true
      d-i partman-lvm/confirm_nooverwrite boolean true
      d-i partman/mount_style select label


      You'll note that I've tried to be quite specific about which partitions/volumes are to be placed on which disks, but partman doesn't seem to honor at least some of that configuration. I've also kept the minimum volume sizes fairly small while I test this configuration on a VM. When I run an install with this configuration onto a VirtualBox VM with smaller drives, the install fails with the error message:



      Error while setting up RAID
      An unexpected error occurred while setting up a preseeded RAID configuration.

      Check /var/log/syslog or see virtual console 4 for the details.


      The relevant section from syslog is as follows:



      Jan 13 02:41:54 md-devices: mdadm: No arrays found in config file or automatically
      Jan 13 02:41:54 partman: No matching physical volumes found
      Jan 13 02:41:54 partman: Reading all physical volumes. This may take a while...
      Jan 13 02:41:54 partman:
      Jan 13 02:41:54 partman: No volume groups found
      Jan 13 02:41:54 partman:
      Jan 13 02:41:54 partman-lvm:
      Jan 13 02:41:54 partman-lvm: No volume groups found
      Jan 13 02:41:54 partman-lvm:
      Jan 13 02:41:56 partman-auto: Available disk space (4294) too small for expert recipe (4608); skipping
      Jan 13 02:41:57 kernel: [ 91.295036] Adding 2095100k swap on /dev/sdc5. Priority:-1 extents:1 across:2095100k FS
      Jan 13 02:41:57 partman: mke2fs 1.42.9 (4-Feb-2014)
      Jan 13 02:41:57 apt-install: Queueing package mdadm for later installation
      Jan 13 02:41:57 partman-auto-raid: Error: No recipe specified in partman-auto-raid/recipe


      I suspect the line 4th from the bottom is most relevant, as you can see that partman has gone ahead and created swap space on /dev/sdc, which wasn't what I wanted.



      I've tried a number of variations of how partitions are specified. I've Googled a lot for versions terms relating to partman recipes and preseed in general, and I can't find a canonical reference for the different configuration options in a recipe and why they're applicable. I've found a number of RAID examples, and many LVM examples, but nothing that mixes the two in the way I'm trying to use them. This thread from the debian-user mailing list suggests that what I want to do isn't possible, and that seem to track with my impression that the partman recipe language doesn't have the tools required to describe what I'm trying to acheive.



      If anyone can point out what I'm doing wrong with my configuration, or even just some good reference materials on partman expert_recipe and the configuration language involved, that'd be most appreciated. At this point it looks like I can automate my entire install, except for the partitioning portion, which is really the main thing I wanted to automate!







      14.04 system-installation lvm mdadm preseed






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 13 '15 at 4:59









      A J

      5,934153457




      5,934153457










      asked Jan 13 '15 at 4:35









      Jim OHalloranJim OHalloran

      12115




      12115





      bumped to the homepage by Community 12 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community 12 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
























          1 Answer
          1






          active

          oldest

          votes


















          0














          Using preseed file to create raid+lvm is tricky.
          Basically, you cannot create a flexible configuration file using preseed. It is not simple and flow as a kickstart in RedHat/CentOS.



          For me, I had to create custom commands using preseed_early syntax.
          You can change is as you like, regarding your configuration.
          The main goal is to create RAID array before the partitioner starts.
          Setup daemon will as you that no /boot partition is defined, ignore this.
          Tested on Debian 9



          So we have four disks



          /dev/sda1 and /dev/sdb1 is a RAID1 mirror -> /dev/md0
          /dev/sda2 and /dev/sdb2 is a RAID0 stripe. -> /dev/md1
          /dev/sdc1 and /dev/sdd1 is a RAID1 mirror. -> /dev/md2



          on md0 he have a /boot partition
          on md1 we have a swap file
          on md2 is a / root.



          so the preseed file is the following:



          d-i partman-auto/disk string /dev/md0 /dev/md1 /dev/md2
          d-i partman-auto/method string lvm



          d-i partman-auto/expert_recipe string
          1 1 -1 lvm
          $defaultignore{ }
          $primary{ }
          device{ /dev/md0 }
          method{ lvm }
          vg_name{ vg00 }
          .
          1 1 -1 lvm
          $defaultignore{ }
          $primary{ }
          device{ /dev/md1 }
          method{ lvm }
          vg_name{ vg01 }
          .
          1 1 -1 lvm
          $defaultignore{ }
          $primary{ }
          device{ /dev/md2 }
          method{ lvm }
          vg_name{ vg02 }
          .
          512 512 512 ext4
          $lvmok{ }
          in_vg{ vg00 }
          lv_name{ lv_boot }
          method{ format } format{ }
          use_filesystem{ } filesystem{ ext4 }
          mountpoint{ /boot }
          .
          512 1024 1024 linux-swap
          $lvmok{ }
          in_vg{ vg02 }
          lv_name{ lv_swap }
          method{ swap } format{ }
          .
          1000 9000 9000 ext4
          $lvmok{ }
          in_vg{ vg01 }
          lv_name{ lv_root }
          method{ format } format{ }
          use_filesystem{ } filesystem{ ext4 }
          mountpoint{ / }
          .



          d-i grub-installer/bootdev string /dev/sda /dev/sdb



          d-i preseed/early_command string /bin/killall.sh;
          /bin/netcfg;



          echo "o# clear the in memory partition table" >> /tmp/fdisk1;
          echo "n# create new partition" >> /tmp/fdisk1;
          echo "p# type primary" >> /tmp/fdisk1;
          echo "1# no. of partition" >> /tmp/fdisk1;
          echo " # default" >> /tmp/fdisk1;
          echo "+512M# partition size" >> /tmp/fdisk1;
          echo "t# partition type" >> /tmp/fdisk1;
          echo "fd# Linux RAID" >> /tmp/fdisk1;
          echo "w# write changes" >> /tmp/fdisk1;

          echo "n# create new partition" >> /tmp/fdisk2;
          echo "p# type primary" >> /tmp/fdisk2;
          echo "2# no. of partition" >> /tmp/fdisk2;
          echo " # default" >> /tmp/fdisk2;
          echo " # partition size" >> /tmp/fdisk2;
          echo "t# partition type" >> /tmp/fdisk2;
          echo "2# no. of partition" >> /tmp/fdisk2;
          echo "fd# Linux RAID" >> /tmp/fdisk2;
          echo "w# write changes" >> /tmp/fdisk2;

          echo "o# clear the in memory partition table" >> /tmp/fdisk3;
          echo "n# create new partition" >> /tmp/fdisk3;
          echo "p# type primary" >> /tmp/fdisk3;
          echo "1# no. of partition" >> /tmp/fdisk3;
          echo " # default" >> /tmp/fdisk3;
          echo " # partition size" >> /tmp/fdisk3;
          echo "t# partition type" >> /tmp/fdisk3;
          echo "fd# Linux RAID" >> /tmp/fdisk3;
          echo "w# write changes" >> /tmp/fdisk3;


          cat /tmp/fdisk1 | grep -o '^[^#]' | fdisk /dev/sda;
          cat /tmp/fdisk1 | grep -o '^[^#]
          ' | fdisk /dev/sdb;
          cat /tmp/fdisk2 | grep -o '^[^#]' | fdisk /dev/sda;
          cat /tmp/fdisk2 | grep -o '^[^#]
          ' | fdisk /dev/sdb;
          /sbin/mdadm --create /dev/md0 --metadata=1.2 --auto=mdp
          --raid-devices=2 --level=1 /dev/sda1 /dev/sdb1;



          cat /tmp/fdisk3 | grep -o '^[^#]' | fdisk /dev/sdc;
          cat /tmp/fdisk3 | grep -o '^[^#]
          ' | fdisk /dev/sdd;
          /sbin/mdadm --create /dev/md1 --metadata=1.2 --auto=mdp
          --raid-devices=2 --level=1 /dev/sdc1 /dev/sdd1;



          /sbin/mdadm --create /dev/md2 --metadata=1.2 --auto=mdp
          --raid-devices=2 --level=0 /dev/sda2 /dev/sdb2;






          share|improve this answer























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "89"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f573108%2fhow-to-configure-raid-2-lvm-volumes-via-preseed%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            Using preseed file to create raid+lvm is tricky.
            Basically, you cannot create a flexible configuration file using preseed. It is not simple and flow as a kickstart in RedHat/CentOS.



            For me, I had to create custom commands using preseed_early syntax.
            You can change is as you like, regarding your configuration.
            The main goal is to create RAID array before the partitioner starts.
            Setup daemon will as you that no /boot partition is defined, ignore this.
            Tested on Debian 9



            So we have four disks



            /dev/sda1 and /dev/sdb1 is a RAID1 mirror -> /dev/md0
            /dev/sda2 and /dev/sdb2 is a RAID0 stripe. -> /dev/md1
            /dev/sdc1 and /dev/sdd1 is a RAID1 mirror. -> /dev/md2



            on md0 he have a /boot partition
            on md1 we have a swap file
            on md2 is a / root.



            so the preseed file is the following:



            d-i partman-auto/disk string /dev/md0 /dev/md1 /dev/md2
            d-i partman-auto/method string lvm



            d-i partman-auto/expert_recipe string
            1 1 -1 lvm
            $defaultignore{ }
            $primary{ }
            device{ /dev/md0 }
            method{ lvm }
            vg_name{ vg00 }
            .
            1 1 -1 lvm
            $defaultignore{ }
            $primary{ }
            device{ /dev/md1 }
            method{ lvm }
            vg_name{ vg01 }
            .
            1 1 -1 lvm
            $defaultignore{ }
            $primary{ }
            device{ /dev/md2 }
            method{ lvm }
            vg_name{ vg02 }
            .
            512 512 512 ext4
            $lvmok{ }
            in_vg{ vg00 }
            lv_name{ lv_boot }
            method{ format } format{ }
            use_filesystem{ } filesystem{ ext4 }
            mountpoint{ /boot }
            .
            512 1024 1024 linux-swap
            $lvmok{ }
            in_vg{ vg02 }
            lv_name{ lv_swap }
            method{ swap } format{ }
            .
            1000 9000 9000 ext4
            $lvmok{ }
            in_vg{ vg01 }
            lv_name{ lv_root }
            method{ format } format{ }
            use_filesystem{ } filesystem{ ext4 }
            mountpoint{ / }
            .



            d-i grub-installer/bootdev string /dev/sda /dev/sdb



            d-i preseed/early_command string /bin/killall.sh;
            /bin/netcfg;



            echo "o# clear the in memory partition table" >> /tmp/fdisk1;
            echo "n# create new partition" >> /tmp/fdisk1;
            echo "p# type primary" >> /tmp/fdisk1;
            echo "1# no. of partition" >> /tmp/fdisk1;
            echo " # default" >> /tmp/fdisk1;
            echo "+512M# partition size" >> /tmp/fdisk1;
            echo "t# partition type" >> /tmp/fdisk1;
            echo "fd# Linux RAID" >> /tmp/fdisk1;
            echo "w# write changes" >> /tmp/fdisk1;

            echo "n# create new partition" >> /tmp/fdisk2;
            echo "p# type primary" >> /tmp/fdisk2;
            echo "2# no. of partition" >> /tmp/fdisk2;
            echo " # default" >> /tmp/fdisk2;
            echo " # partition size" >> /tmp/fdisk2;
            echo "t# partition type" >> /tmp/fdisk2;
            echo "2# no. of partition" >> /tmp/fdisk2;
            echo "fd# Linux RAID" >> /tmp/fdisk2;
            echo "w# write changes" >> /tmp/fdisk2;

            echo "o# clear the in memory partition table" >> /tmp/fdisk3;
            echo "n# create new partition" >> /tmp/fdisk3;
            echo "p# type primary" >> /tmp/fdisk3;
            echo "1# no. of partition" >> /tmp/fdisk3;
            echo " # default" >> /tmp/fdisk3;
            echo " # partition size" >> /tmp/fdisk3;
            echo "t# partition type" >> /tmp/fdisk3;
            echo "fd# Linux RAID" >> /tmp/fdisk3;
            echo "w# write changes" >> /tmp/fdisk3;


            cat /tmp/fdisk1 | grep -o '^[^#]' | fdisk /dev/sda;
            cat /tmp/fdisk1 | grep -o '^[^#]
            ' | fdisk /dev/sdb;
            cat /tmp/fdisk2 | grep -o '^[^#]' | fdisk /dev/sda;
            cat /tmp/fdisk2 | grep -o '^[^#]
            ' | fdisk /dev/sdb;
            /sbin/mdadm --create /dev/md0 --metadata=1.2 --auto=mdp
            --raid-devices=2 --level=1 /dev/sda1 /dev/sdb1;



            cat /tmp/fdisk3 | grep -o '^[^#]' | fdisk /dev/sdc;
            cat /tmp/fdisk3 | grep -o '^[^#]
            ' | fdisk /dev/sdd;
            /sbin/mdadm --create /dev/md1 --metadata=1.2 --auto=mdp
            --raid-devices=2 --level=1 /dev/sdc1 /dev/sdd1;



            /sbin/mdadm --create /dev/md2 --metadata=1.2 --auto=mdp
            --raid-devices=2 --level=0 /dev/sda2 /dev/sdb2;






            share|improve this answer




























              0














              Using preseed file to create raid+lvm is tricky.
              Basically, you cannot create a flexible configuration file using preseed. It is not simple and flow as a kickstart in RedHat/CentOS.



              For me, I had to create custom commands using preseed_early syntax.
              You can change is as you like, regarding your configuration.
              The main goal is to create RAID array before the partitioner starts.
              Setup daemon will as you that no /boot partition is defined, ignore this.
              Tested on Debian 9



              So we have four disks



              /dev/sda1 and /dev/sdb1 is a RAID1 mirror -> /dev/md0
              /dev/sda2 and /dev/sdb2 is a RAID0 stripe. -> /dev/md1
              /dev/sdc1 and /dev/sdd1 is a RAID1 mirror. -> /dev/md2



              on md0 he have a /boot partition
              on md1 we have a swap file
              on md2 is a / root.



              so the preseed file is the following:



              d-i partman-auto/disk string /dev/md0 /dev/md1 /dev/md2
              d-i partman-auto/method string lvm



              d-i partman-auto/expert_recipe string
              1 1 -1 lvm
              $defaultignore{ }
              $primary{ }
              device{ /dev/md0 }
              method{ lvm }
              vg_name{ vg00 }
              .
              1 1 -1 lvm
              $defaultignore{ }
              $primary{ }
              device{ /dev/md1 }
              method{ lvm }
              vg_name{ vg01 }
              .
              1 1 -1 lvm
              $defaultignore{ }
              $primary{ }
              device{ /dev/md2 }
              method{ lvm }
              vg_name{ vg02 }
              .
              512 512 512 ext4
              $lvmok{ }
              in_vg{ vg00 }
              lv_name{ lv_boot }
              method{ format } format{ }
              use_filesystem{ } filesystem{ ext4 }
              mountpoint{ /boot }
              .
              512 1024 1024 linux-swap
              $lvmok{ }
              in_vg{ vg02 }
              lv_name{ lv_swap }
              method{ swap } format{ }
              .
              1000 9000 9000 ext4
              $lvmok{ }
              in_vg{ vg01 }
              lv_name{ lv_root }
              method{ format } format{ }
              use_filesystem{ } filesystem{ ext4 }
              mountpoint{ / }
              .



              d-i grub-installer/bootdev string /dev/sda /dev/sdb



              d-i preseed/early_command string /bin/killall.sh;
              /bin/netcfg;



              echo "o# clear the in memory partition table" >> /tmp/fdisk1;
              echo "n# create new partition" >> /tmp/fdisk1;
              echo "p# type primary" >> /tmp/fdisk1;
              echo "1# no. of partition" >> /tmp/fdisk1;
              echo " # default" >> /tmp/fdisk1;
              echo "+512M# partition size" >> /tmp/fdisk1;
              echo "t# partition type" >> /tmp/fdisk1;
              echo "fd# Linux RAID" >> /tmp/fdisk1;
              echo "w# write changes" >> /tmp/fdisk1;

              echo "n# create new partition" >> /tmp/fdisk2;
              echo "p# type primary" >> /tmp/fdisk2;
              echo "2# no. of partition" >> /tmp/fdisk2;
              echo " # default" >> /tmp/fdisk2;
              echo " # partition size" >> /tmp/fdisk2;
              echo "t# partition type" >> /tmp/fdisk2;
              echo "2# no. of partition" >> /tmp/fdisk2;
              echo "fd# Linux RAID" >> /tmp/fdisk2;
              echo "w# write changes" >> /tmp/fdisk2;

              echo "o# clear the in memory partition table" >> /tmp/fdisk3;
              echo "n# create new partition" >> /tmp/fdisk3;
              echo "p# type primary" >> /tmp/fdisk3;
              echo "1# no. of partition" >> /tmp/fdisk3;
              echo " # default" >> /tmp/fdisk3;
              echo " # partition size" >> /tmp/fdisk3;
              echo "t# partition type" >> /tmp/fdisk3;
              echo "fd# Linux RAID" >> /tmp/fdisk3;
              echo "w# write changes" >> /tmp/fdisk3;


              cat /tmp/fdisk1 | grep -o '^[^#]' | fdisk /dev/sda;
              cat /tmp/fdisk1 | grep -o '^[^#]
              ' | fdisk /dev/sdb;
              cat /tmp/fdisk2 | grep -o '^[^#]' | fdisk /dev/sda;
              cat /tmp/fdisk2 | grep -o '^[^#]
              ' | fdisk /dev/sdb;
              /sbin/mdadm --create /dev/md0 --metadata=1.2 --auto=mdp
              --raid-devices=2 --level=1 /dev/sda1 /dev/sdb1;



              cat /tmp/fdisk3 | grep -o '^[^#]' | fdisk /dev/sdc;
              cat /tmp/fdisk3 | grep -o '^[^#]
              ' | fdisk /dev/sdd;
              /sbin/mdadm --create /dev/md1 --metadata=1.2 --auto=mdp
              --raid-devices=2 --level=1 /dev/sdc1 /dev/sdd1;



              /sbin/mdadm --create /dev/md2 --metadata=1.2 --auto=mdp
              --raid-devices=2 --level=0 /dev/sda2 /dev/sdb2;






              share|improve this answer


























                0












                0








                0







                Using preseed file to create raid+lvm is tricky.
                Basically, you cannot create a flexible configuration file using preseed. It is not simple and flow as a kickstart in RedHat/CentOS.



                For me, I had to create custom commands using preseed_early syntax.
                You can change is as you like, regarding your configuration.
                The main goal is to create RAID array before the partitioner starts.
                Setup daemon will as you that no /boot partition is defined, ignore this.
                Tested on Debian 9



                So we have four disks



                /dev/sda1 and /dev/sdb1 is a RAID1 mirror -> /dev/md0
                /dev/sda2 and /dev/sdb2 is a RAID0 stripe. -> /dev/md1
                /dev/sdc1 and /dev/sdd1 is a RAID1 mirror. -> /dev/md2



                on md0 he have a /boot partition
                on md1 we have a swap file
                on md2 is a / root.



                so the preseed file is the following:



                d-i partman-auto/disk string /dev/md0 /dev/md1 /dev/md2
                d-i partman-auto/method string lvm



                d-i partman-auto/expert_recipe string
                1 1 -1 lvm
                $defaultignore{ }
                $primary{ }
                device{ /dev/md0 }
                method{ lvm }
                vg_name{ vg00 }
                .
                1 1 -1 lvm
                $defaultignore{ }
                $primary{ }
                device{ /dev/md1 }
                method{ lvm }
                vg_name{ vg01 }
                .
                1 1 -1 lvm
                $defaultignore{ }
                $primary{ }
                device{ /dev/md2 }
                method{ lvm }
                vg_name{ vg02 }
                .
                512 512 512 ext4
                $lvmok{ }
                in_vg{ vg00 }
                lv_name{ lv_boot }
                method{ format } format{ }
                use_filesystem{ } filesystem{ ext4 }
                mountpoint{ /boot }
                .
                512 1024 1024 linux-swap
                $lvmok{ }
                in_vg{ vg02 }
                lv_name{ lv_swap }
                method{ swap } format{ }
                .
                1000 9000 9000 ext4
                $lvmok{ }
                in_vg{ vg01 }
                lv_name{ lv_root }
                method{ format } format{ }
                use_filesystem{ } filesystem{ ext4 }
                mountpoint{ / }
                .



                d-i grub-installer/bootdev string /dev/sda /dev/sdb



                d-i preseed/early_command string /bin/killall.sh;
                /bin/netcfg;



                echo "o# clear the in memory partition table" >> /tmp/fdisk1;
                echo "n# create new partition" >> /tmp/fdisk1;
                echo "p# type primary" >> /tmp/fdisk1;
                echo "1# no. of partition" >> /tmp/fdisk1;
                echo " # default" >> /tmp/fdisk1;
                echo "+512M# partition size" >> /tmp/fdisk1;
                echo "t# partition type" >> /tmp/fdisk1;
                echo "fd# Linux RAID" >> /tmp/fdisk1;
                echo "w# write changes" >> /tmp/fdisk1;

                echo "n# create new partition" >> /tmp/fdisk2;
                echo "p# type primary" >> /tmp/fdisk2;
                echo "2# no. of partition" >> /tmp/fdisk2;
                echo " # default" >> /tmp/fdisk2;
                echo " # partition size" >> /tmp/fdisk2;
                echo "t# partition type" >> /tmp/fdisk2;
                echo "2# no. of partition" >> /tmp/fdisk2;
                echo "fd# Linux RAID" >> /tmp/fdisk2;
                echo "w# write changes" >> /tmp/fdisk2;

                echo "o# clear the in memory partition table" >> /tmp/fdisk3;
                echo "n# create new partition" >> /tmp/fdisk3;
                echo "p# type primary" >> /tmp/fdisk3;
                echo "1# no. of partition" >> /tmp/fdisk3;
                echo " # default" >> /tmp/fdisk3;
                echo " # partition size" >> /tmp/fdisk3;
                echo "t# partition type" >> /tmp/fdisk3;
                echo "fd# Linux RAID" >> /tmp/fdisk3;
                echo "w# write changes" >> /tmp/fdisk3;


                cat /tmp/fdisk1 | grep -o '^[^#]' | fdisk /dev/sda;
                cat /tmp/fdisk1 | grep -o '^[^#]
                ' | fdisk /dev/sdb;
                cat /tmp/fdisk2 | grep -o '^[^#]' | fdisk /dev/sda;
                cat /tmp/fdisk2 | grep -o '^[^#]
                ' | fdisk /dev/sdb;
                /sbin/mdadm --create /dev/md0 --metadata=1.2 --auto=mdp
                --raid-devices=2 --level=1 /dev/sda1 /dev/sdb1;



                cat /tmp/fdisk3 | grep -o '^[^#]' | fdisk /dev/sdc;
                cat /tmp/fdisk3 | grep -o '^[^#]
                ' | fdisk /dev/sdd;
                /sbin/mdadm --create /dev/md1 --metadata=1.2 --auto=mdp
                --raid-devices=2 --level=1 /dev/sdc1 /dev/sdd1;



                /sbin/mdadm --create /dev/md2 --metadata=1.2 --auto=mdp
                --raid-devices=2 --level=0 /dev/sda2 /dev/sdb2;






                share|improve this answer













                Using preseed file to create raid+lvm is tricky.
                Basically, you cannot create a flexible configuration file using preseed. It is not simple and flow as a kickstart in RedHat/CentOS.



                For me, I had to create custom commands using preseed_early syntax.
                You can change is as you like, regarding your configuration.
                The main goal is to create RAID array before the partitioner starts.
                Setup daemon will as you that no /boot partition is defined, ignore this.
                Tested on Debian 9



                So we have four disks



                /dev/sda1 and /dev/sdb1 is a RAID1 mirror -> /dev/md0
                /dev/sda2 and /dev/sdb2 is a RAID0 stripe. -> /dev/md1
                /dev/sdc1 and /dev/sdd1 is a RAID1 mirror. -> /dev/md2



                on md0 he have a /boot partition
                on md1 we have a swap file
                on md2 is a / root.



                so the preseed file is the following:



                d-i partman-auto/disk string /dev/md0 /dev/md1 /dev/md2
                d-i partman-auto/method string lvm



                d-i partman-auto/expert_recipe string
                1 1 -1 lvm
                $defaultignore{ }
                $primary{ }
                device{ /dev/md0 }
                method{ lvm }
                vg_name{ vg00 }
                .
                1 1 -1 lvm
                $defaultignore{ }
                $primary{ }
                device{ /dev/md1 }
                method{ lvm }
                vg_name{ vg01 }
                .
                1 1 -1 lvm
                $defaultignore{ }
                $primary{ }
                device{ /dev/md2 }
                method{ lvm }
                vg_name{ vg02 }
                .
                512 512 512 ext4
                $lvmok{ }
                in_vg{ vg00 }
                lv_name{ lv_boot }
                method{ format } format{ }
                use_filesystem{ } filesystem{ ext4 }
                mountpoint{ /boot }
                .
                512 1024 1024 linux-swap
                $lvmok{ }
                in_vg{ vg02 }
                lv_name{ lv_swap }
                method{ swap } format{ }
                .
                1000 9000 9000 ext4
                $lvmok{ }
                in_vg{ vg01 }
                lv_name{ lv_root }
                method{ format } format{ }
                use_filesystem{ } filesystem{ ext4 }
                mountpoint{ / }
                .



                d-i grub-installer/bootdev string /dev/sda /dev/sdb



                d-i preseed/early_command string /bin/killall.sh;
                /bin/netcfg;



                echo "o# clear the in memory partition table" >> /tmp/fdisk1;
                echo "n# create new partition" >> /tmp/fdisk1;
                echo "p# type primary" >> /tmp/fdisk1;
                echo "1# no. of partition" >> /tmp/fdisk1;
                echo " # default" >> /tmp/fdisk1;
                echo "+512M# partition size" >> /tmp/fdisk1;
                echo "t# partition type" >> /tmp/fdisk1;
                echo "fd# Linux RAID" >> /tmp/fdisk1;
                echo "w# write changes" >> /tmp/fdisk1;

                echo "n# create new partition" >> /tmp/fdisk2;
                echo "p# type primary" >> /tmp/fdisk2;
                echo "2# no. of partition" >> /tmp/fdisk2;
                echo " # default" >> /tmp/fdisk2;
                echo " # partition size" >> /tmp/fdisk2;
                echo "t# partition type" >> /tmp/fdisk2;
                echo "2# no. of partition" >> /tmp/fdisk2;
                echo "fd# Linux RAID" >> /tmp/fdisk2;
                echo "w# write changes" >> /tmp/fdisk2;

                echo "o# clear the in memory partition table" >> /tmp/fdisk3;
                echo "n# create new partition" >> /tmp/fdisk3;
                echo "p# type primary" >> /tmp/fdisk3;
                echo "1# no. of partition" >> /tmp/fdisk3;
                echo " # default" >> /tmp/fdisk3;
                echo " # partition size" >> /tmp/fdisk3;
                echo "t# partition type" >> /tmp/fdisk3;
                echo "fd# Linux RAID" >> /tmp/fdisk3;
                echo "w# write changes" >> /tmp/fdisk3;


                cat /tmp/fdisk1 | grep -o '^[^#]' | fdisk /dev/sda;
                cat /tmp/fdisk1 | grep -o '^[^#]
                ' | fdisk /dev/sdb;
                cat /tmp/fdisk2 | grep -o '^[^#]' | fdisk /dev/sda;
                cat /tmp/fdisk2 | grep -o '^[^#]
                ' | fdisk /dev/sdb;
                /sbin/mdadm --create /dev/md0 --metadata=1.2 --auto=mdp
                --raid-devices=2 --level=1 /dev/sda1 /dev/sdb1;



                cat /tmp/fdisk3 | grep -o '^[^#]' | fdisk /dev/sdc;
                cat /tmp/fdisk3 | grep -o '^[^#]
                ' | fdisk /dev/sdd;
                /sbin/mdadm --create /dev/md1 --metadata=1.2 --auto=mdp
                --raid-devices=2 --level=1 /dev/sdc1 /dev/sdd1;



                /sbin/mdadm --create /dev/md2 --metadata=1.2 --auto=mdp
                --raid-devices=2 --level=0 /dev/sda2 /dev/sdb2;







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Sep 10 '18 at 13:13









                jawayayjawayay

                1




                1






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Ask Ubuntu!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f573108%2fhow-to-configure-raid-2-lvm-volumes-via-preseed%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    GameSpot

                    日野市

                    Tu-95轟炸機