Debian Installer preseeding: partitioning

For automated Debian installations you usually have two choices:
  • scripted install
  • image based
I actually don't like image based installs - they are usually a pain to update (with security updates, etc). For our automated installations I therefore chose a scripted approach, based on preseeding.
Most things are quite obvious to implement, but there are a few tricks still.

Partitioning is one of the tasks which is really tricky. It's so easy to get something wrong, and the installer will just not tell you why it failed.

What I wanted to achieve:
  • 16GB root fs on the first HP SmartArray device, outside LVM
  • rest of the first hpsa device as an LVM PV
  • one LVM VG called "vg1"
  • 1GB swap inside that
  • leave the other devices untouched
After taking a look at the relevant docs it looked like I could preseed the LVM stuff, but in the end I gave up doing that. Time needed to figure out what's wrong just isn't worth it.

So I ended up doing a simple recipe, which creates a 16GB rootfs (becoming /dev/cciss/c0d0p1) and a swap partition. The swap partition usually ends up being a logical partition, spanning the rest of the blockdevice (becoming /dev/cciss/c0d0p5).

d-i partman-auto/expert_recipe string regularvnode :: 16000 16000 16000 ext3 $primary{ } $bootable{ } method{ format } format{ } use_filesystem{ } filesystem{ ext3 } mountpoint{ / } .  100 10000 1000000000 linux-swap method{ swap } format{ } .

This example actually works. So safe it for reference!

In the late script I then run parted to drop the swap partition and prepare LVM:

Example late_script:

echo "Configuring LVM"
swapoff -a
swapoff /dev/cciss/c0d0p5
parted /dev/cciss/c0d0 -- rm 2
parted /dev/cciss/c0d0 -- mkpart primary ext2 16GB -1s
parted /dev/cciss/c0d0 -- toggle 2 lvm
pvcreate /dev/cciss/c0d0p2
apt-install lvm2 # make sure target knows about lvm
All of this was only tested with Debian etch. The lenny installer has a new share of problems, and I haven't successfully seeded it yet.

One thing to know: you can't have no swap partition. While this works when doing a manual install, it doesn't when seeded. In my experience the installer would just endlessly loop in the partitioner.