1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00
lvm2/lib/device
Peter Rajnoha 317fae4024
dev-type: detect mixed dos partition with gpt's PMBR
Detect when we have mixed dos partition with gpt's PMBR partition.

This is not a sane configuration, but detect it anyway, just in case
someone configures such partition layout manually and forcefully and
incorrectly defines one of the partition types to be the GPT's PMBR.

For example:

  ❯  fdisk -l /dev/sdc

  Device     Boot Start    End Sectors Size Id Type
  /dev/sdc1        2048  67583   65536  32M 83 Linux
  /dev/sdc2       67584 262143  194560  95M ee GPT

Before:
(The partition filter passes even though there's real existing dos
partition - the empty GPT PMBR overrides it.)

  ❯  pvcreate /dev/sdc
  WARNING: PMBR signature detected on /dev/sdc at offset 510. Wipe it? [y/n]:
  Wiping PMBR signature on /dev/sdc.
  Physical volume "/dev/sdc" successfully created.

With this patch applied:
(The GPT PMBR does not override the existence of the dos partition.)

  ❯  pvcreate /dev/sdc
    Cannot use /dev/sdc: device is partitioned
2024-10-03 09:55:36 +02:00
..
bcache-utils.c gcc: correct signess comparation 2023-07-13 21:31:18 +02:00
bcache.c cleanup: typos in comments 2024-08-30 16:51:15 +02:00
bcache.h cleanup: typos in comments 2024-08-30 16:51:15 +02:00
dev_util.c devices: factor common list functions 2022-11-07 11:38:46 -06:00
dev-cache.c cleanup: typos in comments 2024-08-30 16:51:15 +02:00
dev-cache.h Revert "dev-cache: move global variables into cmd struct" 2024-07-08 15:32:41 -05:00
dev-dasd.c cleanup: typos in comments 2024-08-30 16:51:15 +02:00
dev-ext-udev-constants.h cleanup: typos in comments 2024-08-30 16:51:15 +02:00
dev-ext.c const: use arrays of strings 2024-05-04 01:01:57 +02:00
dev-io.c devices: isolate fake device setup for config file 2024-07-02 16:18:09 -05:00
dev-luks.c filter: remove unused EAGAIN case and flag 2022-04-06 12:51:34 -05:00
dev-lvm1-pool.c build: Don't generate symlinks in include/ dir 2018-05-14 10:30:20 +01:00
dev-md.c cov: annotate known case 2024-08-09 15:10:24 +02:00
dev-mpath.c cleanup: typos in comments 2024-08-30 16:51:15 +02:00
dev-swap.c filter: remove unused EAGAIN case and flag 2022-04-06 12:51:34 -05:00
dev-type.c dev-type: detect mixed dos partition with gpt's PMBR 2024-10-03 09:55:36 +02:00
dev-type.h device: propagate struct cmd_context 2024-05-27 15:35:17 +02:00
device_id.c cleanup: typos in comments 2024-08-30 16:51:15 +02:00
device_id.h gcc: drop const specifier from allocated string 2024-06-03 15:30:05 +02:00
device-types.h devices: recognise rbd (ceph rados block device) 2021-12-13 13:32:06 -06:00
device.h cleanup: replace use of alloced with allocated 2024-09-27 13:42:45 +02:00
filesystem.c filesystem: add note about swap devices 2024-10-02 13:31:54 +02:00
filesystem.h lvresize: fail early if crypt device is missing 2023-01-30 17:12:11 -06:00
online.c cleanup: typos in comments 2024-08-30 16:51:15 +02:00
online.h cleanup: some more MAJOR MINOR unsigned 2024-06-03 15:30:05 +02:00
parse_vpd.c gcc: correct signess comparation 2023-07-13 21:31:18 +02:00