Disk Partitioning
On EL7 disk partitioning is done using the
fstab component, this supports adding disks at any time, not just during the install.
For Debian/Ubuntu the partition layout can be configured via the fstab component but the actual work is done in the installer using partman, any post-install changes currently have to be done manually.
The Debian installer partman configuration comes from
templates/lcfg_disks.seed.tt
and
templates/custom_recipe.tt
in the
lcfg-install
package.
LVM
On Debian/Ubuntu LVM is enabled by default at install time and, other than
/boot
, the partitions are created as logical volumes. There is currently no support for disabling LVM other than by overriding all the preseed options.
d-i partman-auto/method string lvm
Note that due to this the partition names for a disk in the fstab resources (e.g.
sda1
,
sda2
) generally have little meaning. The ordering of the tags
is important though. It is expected that grub/efi and
/boot
partitions come at the start of the list before the partitions which can always be LVM volumes.
Any post-install adjustments to the LVM configuration have to be done manually.
GPT
On EL7 the disk will configured to use GPT when the
fstab.label_<tag>
(e.g.
fstab.label_sda
) resource is set to
gpt
. On Debian/Ubuntu GPT is enabled by default unless overridden through the preseed resources.
# Using GPT, not sure this is all absolutely necessary
d-i partman-basicfilesystems/choose_label string gpt
d-i partman-basicfilesystems/default_label string gpt
d-i partman-partitioning/choose_label string gpt
d-i partman-partitioning/default_label string gpt
d-i partman/choose_label string gpt
d-i partman/default_label string gpt
UEFI / Legacy boot
On EL7 the default is legacy boot, UEFI can be enabled by either defining the
USE_UEFI
macro at the top of the LCFG profile or by including the
lcfg/options/boot-uefi.h
header.
On Debian/Ubuntu the default is UEFI boot, legacy can be enabled by either defining the
USE_LEGACY_BOOT
macro at the top of the LCFG profile or by including the
lcfg/options/boot-legacy.h
header.
As well as controlling the boot mechanism this affects the disk layout.
EL7
On EL7 with UEFI the partition layout begins like:
1 524kB 83.9GB 83.9GB ext4 sda1
2 83.9GB 84.2GB 287MB fat32 sda2 boot
Where the second partition is mounted as
/boot/efi
. With legacy boot the layout begins like:
1 524kB 16.8GB 16.8GB ext4 sda1
2 16.8GB 16.8GB 4719kB sda2 bios_grub
In each case the first partition is mounted as
/
(root).
Debian/Ubuntu
On Debian with UEFI the partition layout looks like:
With legacy boot the layout looks like this:
1 1049kB 4194kB 3146kB bios_grub
2 4194kB 1029MB 1024MB ext2
3 1029MB 21.5GB 20.4GB lvm
Where the second partition is mounted as
/boot
, note that it's not strictly required these days as grub2 can now access LVM volumes.
Disk Encryption
The fstab component provides support for configuring dm-crypt via
/etc/crypttab
so that partitions (e.g.
/tmp
and swap) can be encrypted with a random key at boot time. Work on adding support for this in Debian/Ubuntu is ongoing.
Preserving Partitions
The LCFG fstab component supports preserving the partition layout and the contents of particular partitions. Although it should be possible we do not yet support this for Debian/Ubuntu installs. In reality given the switch to LVM by default all systems will need to be fully reinstalled so this is not a big issue at this time.
Debian partman
The partman recipe can be selected by setting the
install.disk_layout
resource. The default is
lcfg
which means the layout will be driven by the LCFG fstab component resources. It may otherwise be set to one of
atomic
,
multi
or
home
which will mean the standard Debian/Ubuntu recipe of that name is used.
The standard recipes can be found at:
Useful notes:
--
squinney - 2020-04-17