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

Bug#768897: MBR disklabels also yield destructive pvcreate



Control: severity -1 important
Control: clone -1 -2
Control: retitle -2 Installation manual should warn about the use of LVM partition types
Control: reassign -2 installation-guide

On Sun, Jan 18, 2015 at 04:24:43PM +0000, Steve McIntyre wrote:
>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.

And after playing with this a lot more, I'm going to have to admit
defeat I'm afraid. The code in partman-lvm is very flexible in terms
of allowing user choice, but that actually makes this particular case
even harder.

The best thing I can tell you is: don't use the partition types for
LVM unless you really want to use LVM on those partitions! Sorry. :-/

We should add a warning in the installation manual for this corner
case, at least. I've opened a new bug for that above.

-- 
Steve McIntyre, Cambridge, UK.                                steve@einval.com
There's no sensation to compare with this
Suspended animation, A state of bliss


Reply to: