Preseed notes: autopartition with LVM

Posted on 24 Aug 2016, By Luis Vinay under Linux

Get Started

Working with preseed can be so so frustrating, but once you start to get the hang of it starts to make sense.

Here are some notes, and more important some examples for you to use, feel free to comment.

For this example keep in mind this:

Disk device here is “/dev/vda”
We’re going to set up LVM
The LVM Volume Group is called “vg00”
We’re creating a ext2 boot filesystem of 200Mb (non-lvm)
We’re creating a swap filesystem of 2048Mb (lvm)
We’re creating a ext3 root filesystem of 2000Mb (lvm)
We’re creating a xfs var filesystem of whatever space is left (lvm)
d-i partman-auto/disk string /dev/vda
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-auto/method string lvm
d-i partman-lvm/confirm boolean true
d-i partman-auto/choose_recipe select boot-root
d-i partman-auto-lvm/new_vg_name string vg00
d-i partman-auto/expert_recipe string \
boot-root :: \
200 10 200 ext2\
$defaultignore{ }\
method{ format }\
format{ }\
use_filesystem{ }\
filesystem{ ext2 }\
mountpoint{ /boot }\
.\
2048 60 2048 swap \
$defaultignore{ } \
$lvmok{ } \
format{ } \
lv_name{ swap } \
method{ swap } \
. \
2000 20 5000 ext3\
$defaultignore{ } \
$lvmok{ } \
lv_name{ root } \
method{ format } \
format{ } \
use_filesystem{ } \
filesystem{ ext3 } \
mountpoint{ / } \
. \
4000 30 -1 ext3\
$defaultignore{ } \
$lvmok{ } \
lv_name{ var } \
method{ format } \
format{ } \
use_filesystem{ } \
filesystem{ xfs } \
mountpoint{ /var } \
.

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

With the info here you petty much have all the information you need, because most parameters are self explainatory, but let’s take a closer look to this peace of code:

4000 30 1000000000 ext3\
$defaultignore{ } \
$lvmok{ } \
lv_name{ var } \
method{ format } \
format{ } \
use_filesystem{ } \
filesystem{ xfs } \
mountpoint{ /var }

The first line “4000 30 -1 ext3” states a partition with a size in with at least 4000MB and can grow up to -1MB which is the way to say: “fill up the disk”, the “30” is the priority over the other partitions defined in the recipe in the case two or more partitions have to compete for the space.

The next line that might confuse you es “filesystem{ xfs }”, because you see “ext3” at the first line on this block, the “ext3” is the type of partition but, the actual filesystem is defined with this field.

Prepare Your Infrastructure for the Challenges Ahead

Your clients, investors and business partners will notice the difference, from now on, you can progress with confidence.

Get Started