Ubuntu preseed partman-auto with a ssd end a lvm on RAID

I’m trying to preseed an Ubuntu 16.04 on a SuperMicro server which has one 32 GiB SSD and two 1TB disks in RAID1 I configured in BIOS.

My goal is to have this partitions:

SSD:
2GB /boot
1 or 2GB swap
28GB /

Raid:
One lvm partition that fills the disk mounted in /opt

This is my partman-auto preseed file:

### Partitioning
d-i partman-auto/disk string /dev/sda /dev/md126
d-i partman-auto/method string lvm

d-i partman-lvm/device_remove_lvm boolean true
d-i partman-lvm/device_remove_lvm_span boolean true
d-i partman-md/device_remove_md boolean true
d-i partman-auto/purge_lvm_from_device boolean true

d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true

d-i partman-auto/expert_recipe string                         \
      boot-root ::                                            \
              1500 50 2000 ext4                               \
                      $primary{ } $bootable{ }                \
                      method{ format } format{ }              \
                      use_filesystem{ } filesystem{ ext4 }    \
                      device { /dev/sda }                     \
                      mountpoint{ /boot }                     \
              .                                               \
              8000 10000 -1 ext4                              \
                      $primary{ }                             \
                      method{ format } format{ }              \
                      use_filesystem{ } filesystem{ ext4 }    \
                      device { /dev/sda }                     \
                      mountpoint{ / }                         \
              .                                               \
              1000 512 2000 linux-swap                        \
                      $primary{ }                             \
                      device { /dev/sda }                     \
                      method{ swap } format{ }                \
              .                                               \
              1024 1024 -1 ext4                               \
                      $lvmok{ }                               \
                      lv_name{ opt }                          \
                      method{ lvm } format { }                \
                      device { /dev/md126 }                   \
              .                                               \

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/confirm_nooverwrite boolean true

But what I get is:

~$ sudo fdisk -l
Disk /dev/sdb: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x8607ea4b

Device     Boot Start        End    Sectors  Size Id Type
/dev/sdb1          63 3711737924 3711737862  1.7T 8e Linux LVM


Disk /dev/sdc: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/sda: 29.5 GiB, 31675383808 bytes, 61865984 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf73319fb

Device     Boot    Start      End  Sectors  Size Id Type
/dev/sda1  *        2048  2930687  2928640  1.4G 83 Linux
/dev/sda2        2930688 46827519 43896832   21G 83 Linux
/dev/sda3       46827520 48781311  1953792  954M 82 Linux swap / Solaris
/dev/sda4       48783358 61863935 13080578  6.2G  5 Extended
/dev/sda5       48783360 61863935 13080576  6.2G 8e Linux LVM


Disk /dev/md126: 1.7 TiB, 1900411879424 bytes, 3711741952 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 131072 bytes / 262144 bytes
Disklabel type: dos
Disk identifier: 0x8607ea4b

Device       Boot Start        End    Sectors  Size Id Type
/dev/md126p1         63 3711737924 3711737862  1.7T 8e Linux LVM

Partition 1 does not start on physical sector boundary.


Disk /dev/mapper/ubuntu--vg-opt: 976 MiB, 1023410176 bytes, 1998848 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

I can’t find any documentation for this type of partman configuration (one disk without lvm and one with). Is there a way to automatically partition my server in a easy way?

My other solution is to use partman only for partitioning the SSD and then setting up lvm on the raid using a shell script in post-install.sh

Answer

You know you’re in a good Job when there aren’t many Stack Exchange Solutions for what you’re attempting to accomplish. All of the preseeding files I’ve seen simply work with Disk Drives because technology was pervasively Spinning Disks and not SSD. Aye-Aye-Aye Zordon! How do we do this?!

Attribution
Source : Link , Question Author : Federico , Answer Author : Yoooo

Leave a Comment