0

I have read so many kickstart configs and pressed recipes that my head is spinning, and I just need some help or clarification regarding this. Before I go too much into the config, the gist is that I am trying to create an unattended Ubuntu Server 18.04 install, the bit that splices my kickstart config and other files into the ISO for it to be used later works perfectly, however the intention here is to utilise two hard disks with LVM, and that's what isn't working.. At all.

Current KS:

#System bootloader configuration
bootloader --location=mbr
#Clear the Master Boot Record
zerombr yes
#Partition clearing information
clearpart --all --initlabel
# Disk partitioning information
################### PARTITIONING ###################
part /boot --size=1024 --onpart=sda1
part /boot/efi --fstype=efi --grow --maxsize=200 --size=20 --onpart=sda2
part pv.01 --size 20480
volgroup mainvg pv.01
logvol swap --fstype swap --name=swaplv --vgname=mainvg --size 1024
logvol / --fstype ext4 --vgname=mainvg --size=4096 --name=rootlv
logvol /var --fstype ext4 --vgname=mainvg --size=4096 --name=varlv
logvol /root2 --fstype ext4 --vgname=mainvg --size=4096 --name=root2lv

preseed partman-lvm/confirm_nooverwrite boolean true
preseed partman-auto-lvm/no_boot boolean true
###################### END #########################

This actually sort-of works, and I get a similar output as below for df -k :

/dev/sda1 ..... /boot
/dev/mapper/mainvg-rootlv .... /
/dev/mapper/mainvg-root2lv .... /root2
/dev/mapper/mainvg-varlv .... /var

However I now need to manually partition SDB and apply a volume group to it along with LV's.. If I try to do this automatically during the installation process via KS, all I do to the block above is:

#System bootloader configuration
bootloader --location=mbr
#Clear the Master Boot Record
zerombr yes
#Partition clearing information
clearpart --all --initlabel
# Disk partitioning information
################### PARTITIONING ###################
part /boot --size=1024 --onpart=sda1
part /boot/efi --fstype=efi --grow --maxsize=200 --size=20 --onpart=sda2
part pv.01 --size 20480
volgroup mainvg pv.01
logvol swap --fstype swap --name=swaplv --vgname=mainvg --size 1024
logvol / --fstype ext4 --vgname=mainvg --size=4096 --name=rootlv
logvol /var --fstype ext4 --vgname=mainvg --size=4096 --name=varlv
logvol /root2 --fstype ext4 --vgname=mainvg --size=4096 --name=root2lv

part pv.02 --size 10240 --ondisk=sdb # This disk is only 10GB
volgroup datavg pv.02
logvol /data --fstype ext4 --vgname=datavg --size=4096 --name=datalv

preseed partman-lvm/confirm_nooverwrite boolean true
preseed partman-auto-lvm/no_boot boolean true
###################### END #########################

However not only does this not work, but it completely prevents the original partitioning block from executing successfully and when the install succeeds, all I get is one SDA partition with a default "ubuntu-vg" group which comes from god-knows-where and that group has a root and swap volume pair and nothing else. SDB is not even mentioned anywhere no matter the tool I use to check, whether it is df -k or sudo lvdisplay so I am completely confused by this behaviour. Also note that pressed recipes have the same result, so after trying hundreds of permutations I am about to give up..

Additionally, the output of sudo fdisk -l | less is confusing and does not seem to match my config at all, when it works (when using the first block I showed above)

fdisk -l output image of the very first and successful run

If anyone at all has any advice on how to successfully use Kickstart to have one VG with several LV's on SDA which also has BOOT as a physical partition (SDA1) while also having a VG for data inside SDB with a /data logical volume, I would be ever-so-grateful.

If more info is needed, I am happy to post back. Thanks in advance.

Christopher H
  • 368
  • 2
  • 18
PM5K
  • 101
  • 1

1 Answers1

0

Recently had to do similar thing, this is what you need

##### Partitioning #####
# Manual installation with lvm
d-i partman-auto/init_automatically_partition select Manual
d-i partman-auto/disk string /dev/sda /dev/sdb
d-i partman-auto/method string lvm
d-i partman-auto-lvm/guided_size string max
# Custom partitioning recipe.
d-i partman-auto/expert_recipe string                         \
      boot-root ::                                            \
              3072 50 3072 ext4                                 \
                      $primary{ } $bootable{ }                \
                      device{ /dev/sda }                      \
                      method{ format } format{ }              \
                      use_filesystem{ } filesystem{ ext4 }    \
                      mountpoint{ /boot }                     \
              .                                               \
              1000 10000000 xfs                             \
                      $lvmignore{ }                          \
                      $primary{ }                            \
                      method{ lvm }                          \
                      device{ /dev/sda }                     \
                      vg_name{ vg00 }             \
              .                                              \
              1000 10000000 xfs                             \
                      $lvmignore{ }                          \
                      $primary{ }                            \
                      method{ lvm }                          \
                      device{ /dev/sdb }                     \
                      vg_name{ vg01 }             \
              .                                              \
              500 10000 20480 xfs                        \
                      $lvmok{} lv_name{ root }                \
                      in_vg{ vg00 }                \
                      device{ /dev/sda }                      \
                      $defaultignore{ }                       \
                      format{ } method{ format }              \
                      use_filesystem{ } filesystem{ xfs }     \
                      mountpoint{ / }                         \
                      options/pquota{ pquota }                \
              .                                          \
              500 10000 51200 xfs                        \
                      $lvmok{} lv_name{ lib }                 \
                      in_vg{ vg00 }                \
                      device{ /dev/sda }                      \
                      $defaultignore{ }                       \
                      format{ } method{ format }              \
                      use_filesystem{ } filesystem{ xfs }     \
                      mountpoint{ /var/lib }                          \
                      options/pquota{ pquota }                \
              .                                          \
              500 10000 3072 xfs                        \
                      $lvmok{} lv_name{ home }                \
                      in_vg{ vg00 }                \
                      device{ /dev/sda }                      \
                      $defaultignore{ }                       \
                      format{ } method{ format }              \
                      use_filesystem{ } filesystem{ xfs }     \
                      mountpoint{ /home }                         \
                      options/pquota{ pquota }                \
              .                                           \
              500 10000 8192 xfs                        \
                      $lvmok{} lv_name{ var_log }                 \
                      in_vg{ vg00 }                \
                      device{ /dev/sda }                      \
                      $defaultignore{ }                       \
                      format{ } method{ format }              \
                      use_filesystem{ } filesystem{ xfs }     \
                      mountpoint{ /var/log }                          \
                      options/pquota{ pquota }                \
              .                                           \
              500 10000 1000000000 xfs                        \
                      $lvmok{} lv_name{ data }                \
                      device{ /dev/sdb }                      \
                      in_vg{ vg01 }                \
                      $defaultignore{ }                       \
                      format{ } method{ format }              \
                      use_filesystem{ } filesystem{ xfs }     \
                      mountpoint{ /data }                         \
                      options/pquota{ pquota }                \
              .                                          \
              500 10000 12288 xfs                        \
                      $lvmok{} lv_name{ logs }                \
                      device{ /dev/sdb }                      \
                      in_vg{ vg01 }                \
                      $defaultignore{ }                       \
                      format{ } method{ format }              \
                      use_filesystem{ } filesystem{ xfs }     \
                      mountpoint{ /data/logs }                        \
                      options/pquota{ pquota }                \
              .                                          \
              500 10000 1000000000 xfs                        \
                      $lvmok{} lv_name{ backup }                  \
                      device{ /dev/sdb }                      \
                      in_vg{ vg01 }                \
                      $defaultignore{ }                       \
                      format{ } method{ format }              \
                      use_filesystem{ } filesystem{ xfs }     \
                      mountpoint{ /data/backup }                          \
                      options/pquota{ pquota }                \
              .

# Automatically confirm various inter-installation questions
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
d-i partman-basicfilesystems/no_swap boolean false
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true