Why does libparted detect partitions with negative labels?

57 Views Asked by At

Maybe I'm not using the right keywords for my Google searches. In that case, please point me in the right direction.

I'm using libparted to detect connected mass-storage media and partitions on my device. One thing I've noticed, is that devices which Linux detects as SATA/SCSI also seem to have a partition with a negative partition number, e.g. /dev/sda-1

When I look for the files in the filesystem (/proc/) for example, I cannot see these partitions. Even calling parted (print all) doesn't display these results. However, using multiple versions of libparted across multiple devices and even toolchains gives me the same results.

For now I've just output a warning message stating that an erroneous partition has been found, but maybe I'm just misinterpreting something? The partitions have no size, no mount point, just the name - they do show up multiple times per device.

So far, these messages have turned up:

[2022-10-17 14:13:42.597] [warning] Found erroneous partiton label /dev/sda-1 // hard disk
[2022-10-17 14:13:42.597] [warning] Found erroneous partition label /dev/sda-1
[2022-10-17 14:13:42.684] [warning] Found erroneous partition label /dev/sdb-1 // flash drive
[2022-10-17 14:13:42.684] [warning] Found erroneous partition label /dev/sdb-1
[2022-10-17 14:13:42.685] [warning] Found erroneous partition label /dev/sdb-1
[2022-10-17 14:13:42.708] [warning] Found erroneous partition label /dev/sdc-1 // also flash drive
[2022-10-17 14:13:42.708] [warning] Found erroneous partition label /dev/sdc-1
[2022-10-17 14:13:42.720] [warning] Found erroneous partition label /dev/sdd-1 // another flash drive
[2022-10-17 14:13:42.721] [warning] Found erroneous partition label /dev/sdd-1
[2022-10-17 14:13:42.721] [warning] Found erroneous partition label /dev/sdd-1

The rest of the data looks okay: (excerpt)

"DevicePath": "/dev/sda2",
"DeviceType": "Partition",
"FreeSpace": 531341312,
"HasPartitions": false,
"MountPath": "/boot/efi",
"PartitionList": null,
"TotalCapacity": 536834048,
"UsedSpace": 5492736

The complete information (as given by parted):

Model: VMware, VMware Virtual S (scsi)
Disk /dev/sda: 215GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name  Flags
 1      1049kB  2097kB  1049kB                     bios_grub
 2      2097kB  540MB   538MB   fat32              boot, esp
 3      540MB   215GB   214GB                      lvm

Does the negative partition number have a specific meaning, or is it something I can safely ignore without missing on any information?

tag libparted doesn't exist. If someone w/ enough rep wants to create one, please feel free. This issue doesn't apply to parted.

0

There are 0 best solutions below