Using preseed to create two volume groups on same disk

Written by - 2 comments

Published on - Listed in Linux


The following preseed partman recipe allows to create two volume groups on the same logical disk (/dev/sda):

d-i partman-auto/disk string /dev/sda
d-i partman-auto/method string lvm
d-i partman-auto/choose_recipe select mypartitioning

d-i partman-auto/expert_recipe string \
      mypartitioning :: \
              512 512 512 ext2                                \
                      $primary{ }                             \
                      $bootable{ }                            \
                      method{ format } format{ }              \
                      use_filesystem{ } filesystem{ ext2 }    \
                      label{ boot }                           \
                      mountpoint{ /boot }                     \
              . \
              122880 122880 122880 ext4                       \
                      $primary{ }                             \
                      method{ lvm }                           \
                      device{ /dev/sda2 }                     \
                      vg_name{ vg1 }                          \
              . \
              122880 1000000000 1000000000 ext4               \
                      $primary{ }                             \
                      method{ lvm }                           \
                      device{ /dev/sda3 }                     \
                      vg_name{ vg2 }                          \
              . \
              8192 8192 8192 linux-swap                       \
                      $lvmok{ } in_vg{ vg1 }                  \
                      lv_name{ swap }                         \
                      method{ swap } format{ }                \
              . \
              10240 10240 10240 ext4                          \
                      $lvmok{ } in_vg{ vg1 }                  \
                      lv_name{ root }                         \
                      method{ format } format{ }              \
                      use_filesystem{ } filesystem{ ext4 }    \
                      label{ root }                           \
                      mountpoint{ / }                         \
              . \
              8192 8192 8192 ext4                             \
                      $lvmok{ } in_vg{ vg1 }                  \
                      lv_name{ var }                          \
                      method{ format } format{ }              \
                      use_filesystem{ } filesystem{ ext4 }    \
                      label{ var }                            \
                      mountpoint{ /var }                      \
              .

This will create:

  • a primary partition with a size of ~500MB (the final OS defined it as 473MB) mounted on /boot
  • Another primary partition with a size of ~122GB (final OS: 114GB) used as PV for the volume group vg1
  • Another primary partition with a minimum size of ~122GB and max size of ... so big to use the whole disk .. for the volume group vg2
  • Create a swap partition with a size of 8GB as LV "swap" in the volume group vg1
  • Create a root (/) partition with a size of 10GB als LV "root" in the volume group vg1
  • Create a /var partition with a size of 8GB as LV "var" in the volume group vg1



Add a comment

Show form to leave a comment

Comments (newest first)

ck from Switzerland wrote on Jan 25th, 2016:

Hi Kevin,

Did you try to NOT use new_vg_name at the begin of partman?
In my example I only defined the vg's within the recipe.

I had to do several try&err until I got it right, too. Unfortunately these kickstart/preseed scripts are not very well documented.

Let me know if it works this way.

cheers,
Claudio


kevin from Fremont, ca wrote on Jan 23rd, 2016:

Hi,

I am trying to build two volume groups using Cobbler but failed.
I can only see one volume group created.
I also tried
d-i partman-auto-lvm/new_vg_name string lxc exportvg
and
d-i partman-auto-lvm/new_vg_name multiselect lxc, exportvg
but failed as well.
What might be the issues?

Regards,

Kevin SZ

d-i partman-auto/choose_recipe select custompartitioning
d-i partman-auto-lvm/new_vg_name string lxc
#d-i partman-auto-lvm/new_vg_name multiselect lxc exportvg
d-i partman-auto/expert_recipe string \
custompartitioning :: \
512 1 512 ext2 \
$primary{ } \
$bootable{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext2 } \
label{ boot } \
mountpoint{ /boot } \
. \
155648 1 155648 ext4 \
$primary{ } \
method{ lvm } \
device{ /dev/sda2 } \
vg_name{ lxc } \
. \
2048 1 2048 linux-swap \
$lvmok{ } in_vg{ lxc } \
lv_name{ swap00 } \
method{ swap } format{ } \
. \
153600 1 153600 ext4 \
$lvmok{ } in_vg{ lxc } \
lv_name{ root00 } \


RSS feed

Blog Tags:

  AWS   Android   Ansible   Apache   Apple   Atlassian   BSD   Backup   Bash   Bluecoat   CMS   Chef   Cloud   Coding   Consul   Containers   CouchDB   DB   DNS   Database   Databases   Docker   ELK   Elasticsearch   Filebeat   FreeBSD   Galera   Git   GlusterFS   Grafana   Graphics   HAProxy   HTML   Hacks   Hardware   Icinga   Influx   Internet   Java   KVM   Kibana   Kodi   Kubernetes   LVM   LXC   Linux   Logstash   Mac   Macintosh   Mail   MariaDB   Minio   MongoDB   Monitoring   Multimedia   MySQL   NFS   Nagios   Network   Nginx   OSSEC   OTRS   Office   OpenSearch   PGSQL   PHP   Perl   Personal   PostgreSQL   Postgres   PowerDNS   Proxmox   Proxy   Python   Rancher   Rant   Redis   Roundcube   SSL   Samba   Seafile   Security   Shell   SmartOS   Solaris   Surveillance   Systemd   TLS   Tomcat   Ubuntu   Unix   VMWare   VMware   Varnish   Virtualization   Windows   Wireless   Wordpress   Wyse   ZFS   Zoneminder