diff --git a/daemon/listfs.ml b/daemon/listfs.ml index 0d274c275..63d6e4f84 100644 --- a/daemon/listfs.ml +++ b/daemon/listfs.ml @@ -84,7 +84,7 @@ and is_not_partitioned_device device = * to read them will cause errors (RHBZ#887520). Assuming that * libguestfs was compiled with ldm support, we'll get the filesystems * on these later. We also ignore Microsoft Reserved Partition and - * Windows Snapshot Partition. + * Windows Snapshot Partition as well as MBR extended partitions. *) and is_partition_can_hold_filesystem partition = let device = Devsparts.part_to_dev partition in @@ -96,21 +96,29 @@ and is_partition_can_hold_filesystem partition = let is_gpt_or_mbr = is_gpt || is_mbr in if is_gpt_or_mbr then ( - (* MBR partition id will be converted into corresponding GPT type. *) - let gpt_type = Parted.part_get_gpt_type device partnum in - match gpt_type with - (* Windows Logical Disk Manager metadata partition. *) - | "5808C8AA-7E8F-42E0-85D2-E1E90434CFB3" + if is_mbr_extended parttype device partnum then + false + else ( + (* MBR partition id will be converted into corresponding GPT type. *) + let gpt_type = Parted.part_get_gpt_type device partnum in + match gpt_type with + (* Windows Logical Disk Manager metadata partition. *) + | "5808C8AA-7E8F-42E0-85D2-E1E90434CFB3" (* Windows Logical Disk Manager data partition. *) | "AF9B60A0-1431-4F62-BC68-3311714A69AD" (* Microsoft Reserved Partition. *) | "E3C9E316-0B5C-4DB8-817D-F92DF00215AE" (* Windows Snapshot Partition. *) | "CADDEBF1-4400-4DE8-B103-12117DCF3CCF" -> false - | _ -> true + | _ -> true + ) ) else true +and is_mbr_extended parttype device partnum = + parttype = "msdos" && + Parted.part_get_mbr_part_type device partnum = "extended" + (* Use vfs-type to check for a filesystem of some sort of [device]. * Returns [Some [device, vfs_type; ...]] if found (there may be * multiple devices found in the case of btrfs), else [None] if nothing diff --git a/tests/regressions/rhbz1285847.sh b/tests/regressions/rhbz1285847.sh index 1bfb9fc19..5f98c973a 100755 --- a/tests/regressions/rhbz1285847.sh +++ b/tests/regressions/rhbz1285847.sh @@ -55,7 +55,6 @@ virt-resize rhbz1285847.img rhbz1285847-2.img --expand /dev/sda2 guestfish --format=raw -a rhbz1285847-2.img run : list-filesystems > rhbz1285847.out if [ "$(cat rhbz1285847.out)" != "/dev/sda1: ext4 -/dev/sda2: unknown /dev/sda5: swap" ]; then echo "$0: unexpected result:" cat rhbz1285847.out