2

I'm trying to get a Preseed file working on a 119GB hard drive and it seems there is not enough space. Basically what I want to do:

/dev/sda1 ext4 mountpoint /boot size 512MB

/dev/sda2 lvm into vg1 size 40GB

/dev/sda3 lvm into vg2 size 70GB

Some logical volumes in each of the volume groups.

The problem that I am encountering is the following:

How does preseed exactly work on the creation of physical partitions, VGs and LVs?

It tells me that i need 147930 MB for the expert-recipe and I only have available 119453 MB. Note that if I partition manually there is more than enough disk space, there will even be free space left!

When it creates the logical volumes it doesn't know that the space for those logical volumes will be allocated from the volume groups already created? It allocates the free space for LVs directly from /dev/sda? If so, how can I tell it to allocate it from each VG?

This is the expert-recipe:

d-i partman-auto/expert_recipe recipe1 :: \
            511 512 512 ext4                        \
            $primary{ }                             \
            $bootable{ }                            \
            method{ format }                        \
            format{ }                               \
            use_filesystem{ }                       \
            filesystem{ ext4 }                      \
            device{ /dev/sda1 }                     \
            mountpoint{ /boot } .                   \
            39999 40000 40000 ext4                  \
            $primary{ }                             \
            method{ lvm }                           \
            device{ /dev/sda2 }                     \
            vg_name{ rootvg } .                     \
            69999 70000 70000 ext4                  \
            $primary{ }                             \
            method{ lvm }                           \
            device{ /dev/sda3 }                     \
            vg_name{ infravg } .                    \
            100 1 100000 ext4                       \
            method{ format }                        \
            format{ }                               \
            use_filesystem{ }                       \
            filesystem{ ext4 }                      \
            mountpoint{ /part1 } .                  \
            5999 1 6000 ext4                        \
            $lvmok{ } in_vg{ rootvg }               \
            lv_name{ var_lv }                       \
            method{ format } format{ }              \
            use_filesystem{ } filesystem{ ext4 }    \
            mountpoint{ /var } .                    \
            3999 1 4000 ext4                        \
            $lvmok{ } in_vg{ rootvg }               \
            lv_name{ usr_lv }                       \
            method{ format } format{ }              \
            use_filesystem{ } filesystem{ ext4 }    \
            mountpoint{ /usr } .                    \
            4999 1 5000 ext4                        \
            $lvmok{ } in_vg{ rootvg }               \
            lv_name{ root_lv }                      \
            method{ format }                        \
            format{ }                               \
            use_filesystem{ }                       \
            filesystem{ ext4 }                      \
            mountpoint{ / } .                       \
            1999 1 2000 ext4                        \
            $lvmok{ } in_vg{ rootvg }               \
            lv_name{ home_lv }                      \
            method{ format } format{ }              \
            use_filesystem{ } filesystem{ ext4 }    \
            mountpoint{ /home } .                   \
            4999 1 5000 ext4                        \
            $lvmok{ } in_vg{ rootvg }               \
            lv_name{ tmp_lv }                       \
            method{ format } format{ }              \
            use_filesystem{ } filesystem{ ext4 }    \
            mountpoint{ /tmp } .                    \
            8000 1 8000 linux-swap                  \
            $lvmok{ } in_vg{ rootvg }               \
            lv_name{ swap }                         \
            method{ swap } format{ } .              \
            999 1 1000 ext4                         \
            $lvmok{ } in_vg{ rootvg }               \
            lv_name{ opt_lv }                       \
            method{ format } format{ }              \
            use_filesystem{ } filesystem{ ext4 }    \
            mountpoint{ /opt } .                    \
            128 1 128 ext4                          \
            $lvmok{ } in_vg{ rootvg }               \
            lv_name{ system_lv }                    \
            method{ format } format{ }              \
            use_filesystem{ } filesystem{ ext4 }    \
            mountpoint{ /system } .                 \
            100 1 100000 ext4                       \
            $lvmok{ } in_vg{ rootvg }               \
            lv_name{ free1_lv }                     \
            method{ format } format{ }              \
            use_filesystem{ } filesystem{ ext4 }    \
            mountpoint{ /part2 } .                  \
            1000 1 1024 ext4                        \
            $lvmok{ } in_vg{ infravg }              \
            lv_name{ chef_lv }                      \
            method{ format } format{ }              \
            use_filesystem{ } filesystem{ ext4 }    \
            mountpoint{ /opt/chef } .               \
            4999 1 5000 ext4                        \
            $lvmok{ } in_vg{ infravg }              \
            lv_name{ images_lv }  5000                  \
            method{ format } format{ }              \
            use_filesystem{ } filesystem{ ext4 }    \
            mountpoint{ /images } .                 \
            100 1 1000000 ext4                      \
            $lvmok{ } in_vg{ infravg }              \
            lv_name{ free2_lv }                     \
            method{ format } format{ }              \
            use_filesystem{ } filesystem{ ext4 }    \
            mountpoint{ /part3 }                    \
            .

closed as unclear what you're asking by Anthon, Archemar, Romeo Ninov, Rui F Ribeiro, Stephen Rauch Aug 10 '17 at 13:10

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • For most of the systems I recently used /boot is a directory, it is unclear what you want /boot 512MB to do. Don't you get something like bash: /boot is a directory if you execute that command? – Anthon Aug 10 '17 at 7:58
  • /boot is the mountpoint for /dev/sda1 which will be one of the 3 primary partitions Sorry if it wasn't clear. I edited the post. – Costin Balan Aug 10 '17 at 8:05
3

So after some research (to the 4th,5th page of google searches!) I read (and I'm also pretty sure it's true) that partman/preseed will calculate total size as sum of the size of all the partitions, it doesn't matter if there are LV partitions which are part of a VG.

If I add the maximum size numbers, indeed, I am getting ~147000 MB. So, what I did to solve this issue? Well, for starters I decreased the minimum size of the partitions in the preseed file to 1/4 or 1/2 of the maximum size, then set all the priorities higher or equal to the maximum size (you can find here and here some additional information regarding this)

This allowed partman/preseed to create all the partitions succesfully, even though they weren't the right size.

In order to achieve the right size I added a late_command script which resized all the logical volumes to their correct size.

Also, to keep all the free space that would remain if partitioning were to be done manually, I created dummy partitions which I later deleted in the same late_command script.

I know it's unorthodox but it's the only way to work with preseed/partman.

Here is also the partitioning recipe:

d-i partman/early_command string debconf-set partman-auto/disk "$(list-devices disk | head -n1)"
d-i partman-auto/method string lvm
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-md/device_remove_md boolean true
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
d-i partman-auto-lvm/new_vg_name string rootvg
d-i partman-auto-lvm/guided_size string 34%
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-md/device_remove_md boolean true
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
d-i partman-auto-lvm/new_vg_name string infravg
d-i partman-auto-lvm/guided_size string 60%
d-i partman-auto/choose_recipe select diod
d-i partman-auto/expert_recipe diod :: \
            511 512 512 ext4                        \
            $primary{ }                             \
            $bootable{ }                            \
            method{ format }                        \
            format{ }                               \
            use_filesystem{ }                       \
            filesystem{ ext4 }                      \
            device{ /dev/sda1 }                     \
            mountpoint{ /boot } .                   \
            39999 40000 40000 ext4                  \
            $primary{ }                             \
            method{ lvm }                           \
            device{ /dev/sda2 }                     \
            vg_name{ rootvg } .                     \
            69999 70000 70000 ext4                  \
            $primary{ }                             \
            method{ lvm }                           \
            device{ /dev/sda3 }                     \
            vg_name{ infravg } .                    \
            100 1000 -1 ext4                        \
            method{ format }                        \
            format{ }                               \
            use_filesystem{ }                       \
            filesystem{ ext4 }                      \
            mountpoint{ /part1 } .                  \
            128 1000 128 ext4                       \
            $lvmok{ } in_vg{ rootvg }               \
            lv_name{ system_lv }                    \
            method{ format } format{ }              \
            use_filesystem{ } filesystem{ ext4 }    \
            mountpoint{ /system } .                 \
            100 1500 1000 ext4                      \
            $lvmok{ } in_vg{ rootvg }               \
            lv_name{ opt_lv }                       \
            method{ format } format{ }              \
            use_filesystem{ } filesystem{ ext4 }    \
            mountpoint{ /opt } .                    \
            100 2500 2000 ext4                      \
            $lvmok{ } in_vg{ rootvg }               \
            lv_name{ home_lv }                      \
            method{ format } format{ }              \
            use_filesystem{ } filesystem{ ext4 }    \
            mountpoint{ /home } .                   \
            100 4500 4000 ext4                     \
            $lvmok{ } in_vg{ rootvg }               \
            lv_name{ usr_lv }                       \
            method{ format } format{ }              \
            use_filesystem{ } filesystem{ ext4 }    \
            mountpoint{ /usr } .                    \
            100 6000 5000 ext4                     \
            $lvmok{ } in_vg{ rootvg }               \
            lv_name{ root_lv }                      \
            method{ format }                        \
            format{ }                               \
            use_filesystem{ }                       \
            filesystem{ ext4 }                      \
            mountpoint{ / } .                       \
            100 5500 5000 ext4                     \
            $lvmok{ } in_vg{ rootvg }               \
            lv_name{ tmp_lv }                       \
            method{ format } format{ }              \
            use_filesystem{ } filesystem{ ext4 }    \
            mountpoint{ /tmp } .                    \
            100 6500 6000 ext4                     \
            $lvmok{ } in_vg{ rootvg }               \
            lv_name{ var_lv }                       \
            method{ format } format{ }              \
            use_filesystem{ } filesystem{ ext4 }    \
            mountpoint{ /var } .                    \
            100 7500 8000 linux-swap               \
            $lvmok{ } in_vg{ rootvg }               \
            lv_name{ swap }                         \
            method{ swap } format{ } .              \
            100 1000 -1 ext4                        \
            $lvmok{ } in_vg{ rootvg }               \
            lv_name{ free1_lv }                     \
            method{ format } format{ }              \
            use_filesystem{ } filesystem{ ext4 }    \
            mountpoint{ /part2 } .                  \
            100 2000 1024 ext4                      \
            $lvmok{ } in_vg{ infravg }              \
            lv_name{ chef_lv }                      \
            method{ format } format{ }              \
            use_filesystem{ } filesystem{ ext4 }    \
            mountpoint{ /opt/chef } .               \
            100 4000 5000 ext4                      \
            $lvmok{ } in_vg{ infravg }              \
            lv_name{ images_lv }                    \
            method{ format } format{ }              \
            use_filesystem{ } filesystem{ ext4 }    \
            mountpoint{ /images } .                 \
            100 1000 -1 ext4                        \
            $lvmok{ } in_vg{ infravg }              \
            lv_name{ free2_lv }                     \
            method{ format } format{ }              \
            use_filesystem{ } filesystem{ ext4 }    \
            mountpoint{ /part3 }                    \
            .
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select Finish
d-i partman/confirm_nooverwrite boolean true
d-i partman/confirm boolean true

Not the answer you're looking for? Browse other questions tagged or ask your own question.