[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#768897: MBR disklabels also yield destructive pvcreate



On Wed, Nov 19, 2014 at 03:36:19PM -0600, Drake Wilson wrote:
>FYI: I've just confirmed with partman-lvm 99 (plus whatever libparted is in
>the last Debian testing weekly ISO) that MBR disklabels using 8e (Linux LVM)
>as a type code for LUKS are also affected by this.  So it's not just GPT.
>It's arguably even more dangerous for MBR, because the type code space is
>so small that collisions should be expected, but util-linux's fdisk in MBR
>mode also provides a 0xda code for "non-FS data", so users in that case may
>be less tempted to default to the underlying volume type.

Hi Drake,

I've just reproduced your findings here, and I'm looking at the code
right now. As you've guessed, the partman-lvm code currently
unconditionally tries to set up *every* partition with an LVM
partition type, regardless. If you're interested the code is in
partman-lvm/choose_partition/lvm/do_option:do_initial_setup(). It
calls into partman-lvm/lib/lvm-base.sh:pv_create(), and pv_create()
checks to see if the partition is already set up as a PV (by calling
"pvs") - if so, it leaves it alone, otherwise it calls "pvcreate".

So... There are a few things to do here:

 1. Don't do what you're doing! This is one of the few areas where the
    partition type matters in d-i
 2. I'm looking to add a check in pv_list() so it will either:
    (a) Ignore partitions tagged with LVM type but some other
        filesystem/blkid contents; OR
    (b) Warn about such partitions and ask the user what to do.

2(a) looks much easier, I'll be honest, so that's my plan for now.

As a point of information, you weren't sure what the "K" tag means in
the d-i partitioner. Ironically, it's short for "Keep", i.e. don't
touch this partition...

-- 
Steve McIntyre, Cambridge, UK.                                steve@einval.com
"Since phone messaging became popular, the young generation has lost the
 ability to read or write anything that is longer than one hundred and sixty
 characters."  -- Ignatios Souvatzis


Reply to: