Linux – Unexpected results from custom partitioning scheme – Ubuntu preseed unattended install

installationlinuxpartitionunattended

I need some help with partman-auto custom recipe in preseed…. it's doing unexpected things, the docs aren't so clear.

This is in my preseed file:

d-i partman-auto/expert_recipe string                     \
  boot-root-var ::                                        \
          1024 100 1024 ext4                               \
                  $primary{ } $bootable{ }                \
                  method{ format } format{ }              \
                  use_filesystem{ } filesystem{ ext4 }    \
                  mountpoint{ /boot }                     \
          .                                               \
          2048  50 4096 ext4                              \
                  method{ format } format{ }              \
                  use_filesystem{ } filesystem{ ext4 }    \
                  mountpoint{ / }                         \
          .                                               \
          4096  25 100000 ext4                            \
                  method{ format } format{ }              \
                  use_filesystem{ } filesystem{ ext4 }    \
                  mountpoint{ /var }                      \
          .                                               \
           256  75 100% linux-swap                        \
                  method{ swap } format{ }                \
          .

Given an 80GB drive. I ended up with these partitions:

/     2GB
/boot 1GB
/var  4GB
swap  72GB

What went wrong? What I want is:

/     2GB
/boot 1GB
/var  72GB
swap  4GB

Best Answer

Try this recipe:

d-i partman-auto/expert_recipe string                     \
  boot-root-var ::                                        \
          1024 1024 1024 ext3                             \
                  $primary{ } $bootable{ }                \
                  method{ format } format{ }              \
                  use_filesystem{ } filesystem{ ext4 }    \
                  mountpoint{ /boot }                     \
          .                                               \
          2048  2048 4096 ext3                            \
                  method{ format } format{ }              \
                  use_filesystem{ } filesystem{ ext4 }    \
                  mountpoint{ / }                         \
          .                                               \
          4096  4096 -1 ext3                              \
                  method{ format } format{ }              \
                  use_filesystem{ } filesystem{ ext4 }    \
                  mountpoint{ /var }                      \
          .                                               \
           256  4096 4096 linux-swap                      \
                  method{ swap } format{ }                \
          .

You can find the documentation for these recipes in devel/partman-auto-recipe.txt, but honestly: these partitioning recipes in preseed files are a real pain compared to Kickstart files or setup-storage from FAI.