[pbs-devel] [PATCH proxmox-backup v15 26/26] api: disks: only return UUID of partitions if it actually is one

Hannes Laimer h.laimer at proxmox.com
Mon Nov 25 17:22:13 CET 2024


Some filesystems like FAT don't include a concept of UUIDs.
Instead, tools like blkid tools like blkid derive these
identifiers based on certain filesystem metadata, such as
volume serial numbers or other unique information. This does
however not follow the format specified in RFC 9562[1].

[1] https://datatracker.ietf.org/doc/html/rfc9562

Signed-off-by: Hannes Laimer <h.laimer at proxmox.com>
---
 src/tools/disks/mod.rs | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/tools/disks/mod.rs b/src/tools/disks/mod.rs
index 6345fde7c..61aceccd6 100644
--- a/src/tools/disks/mod.rs
+++ b/src/tools/disks/mod.rs
@@ -898,7 +898,10 @@ fn get_partitions_info(
             let mut uuid = None;
             if let Some(devpath) = devpath.as_ref() {
                 for info in lsblk_infos.iter().filter(|i| i.path.eq(devpath)) {
-                    uuid = info.uuid.clone();
+                    uuid = info
+                        .uuid
+                        .clone()
+                        .filter(|uuid| pbs_api_types::UUID_REGEX.is_match(uuid));
                     used = match info.partition_type.as_deref() {
                         Some("21686148-6449-6e6f-744e-656564454649") => PartitionUsageType::BIOS,
                         Some("c12a7328-f81f-11d2-ba4b-00a0c93ec93b") => PartitionUsageType::EFI,
-- 
2.39.5





More information about the pbs-devel mailing list