[parted-devel] [PATCH][RFC] Print maximum size of GPT

Anna Maresova anicka at suse.cz
Mon Feb 24 13:47:28 GMT 2020


Hi all,

I encountered with mkpart failure due to maximum size of GPT reached. To be
able to deal with this issue, I would need parted capable of printing the
maximum number of primary partitions.

This patch would do the job for me, but I am not sure if it would not break
something else I am not aware of. Could you please comment on it?

Thanks,
Anna

Index: parted-3.3/parted/parted.c
===================================================================
--- parted-3.3.orig/parted/parted.c
+++ parted-3.3/parted/parted.c
@@ -1125,10 +1125,10 @@ _print_disk_info (const PedDevice *dev,
                                         break;
 
             }
-            printf ("%s:%s:%s:%lld:%lld:%s:%s:%s;\n",
+            printf ("%s:%s:%s:%lld:%lld:%s:%s:%s:%lld;\n",
                     path, end, transport[dev->type],
                     dev->sector_size, dev->phys_sector_size,
-                    pt_name, dev->model, disk_flags);
+                    pt_name, dev->model, disk_flags, diskp->type->ops->get_max_primary_partition_count(diskp));
             free(path);
         } else {
             printf (_("Model: %s (%s)\n"),
@@ -1148,6 +1148,7 @@ _print_disk_info (const PedDevice *dev,
         if (!opt_machine_mode) {
             printf (_("Partition Table: %s\n"), pt_name);
             printf (_("Disk Flags: %s\n"), disk_flags);
+            printf (_("Max Primary Partitions: %lld\n"), diskp->type->ops->get_max_primary_partition_count(diskp));
         }
         free (disk_flags);
 }



More information about the parted-devel mailing list