[parted-devel] [PATCH] Set Disk And Partition UUID on GPT
Arvin Schnell
aschnell at suse.de
Tue Nov 10 16:22:44 GMT 2026
Hi,
appended below is the patch that introduces two commands to set the
disk and partition UUID on GPT partition tables (e.g., parted <device>
disk_uuid <uuid> and parted <device> uuid <number> <uuid>). It
includes documentation and test cases.
t0921-uuid-gpt-reproducible.sh checks the sha256sum of the generated
image. That works fine for me on several architecture (x86-64,
aarch64, ppc64le and s390x). But I'm not sure if every single bit in
the GPT is always well defined (likely it should be).
Unfortunately I had to touch many tests since "parted ... u s p" must
be replaced by "parted ... unit s p" due to the abbreviation
collision.
Kind Regards,
Arvin Schnell
---
NEWS | 3 +
doc/C/parted.8 | 8 ++
doc/parted.texi | 40 ++++++
include/parted/disk.in.h | 6 +
libparted/disk.c | 34 +++++
libparted/labels/gpt.c | 40 ++++++
parted/parted.c | 125 +++++++++++++++++-
tests/Makefile.am | 2 +
tests/t0010-script-no-ctrl-chars.sh | 2 +-
tests/t0200-gpt.sh | 2 +-
...0203-gpt-shortened-device-primary-valid.sh | 2 +-
tests/t0203-gpt-tiny-device-abort.sh | 2 +-
tests/t0205-gpt-list-clobbers-pmbr.sh | 4 +-
...rint-with-corrupt-primary-clobbers-pmbr.sh | 4 +-
tests/t0207-IEC-binary-notation.sh | 10 +-
tests/t0208-mkpart-end-in-IEC.sh | 4 +-
tests/t0209-gpt-pmbr_boot.sh | 2 +-
...t0210-gpt-resized-partition-entry-array.sh | 2 +-
tests/t0211-gpt-rewrite-header.sh | 4 +-
tests/t0212-gpt-many-partitions.sh | 2 +-
tests/t0213-mkpart-start-negative.sh | 2 +-
tests/t0220-gpt-msftres.sh | 2 +-
tests/t0280-gpt-corrupt.sh | 2 +-
tests/t0350-mac-PT-increases-sector-size.sh | 2 +-
tests/t0920-uuid-gpt.sh | 92 +++++++++++++
tests/t0921-uuid-gpt-reproducible.sh | 46 +++++++
tests/t1100-busy-label.sh | 2 +-
tests/t1700-probe-fs.sh | 6 +-
.../t2310-dos-extended-2-sector-min-offset.sh | 4 +-
tests/t2500-probe-corrupt-hfs.sh | 4 +-
tests/t3000-resize-fs.sh | 4 +-
tests/t3001-buffer.sh | 4 +-
tests/t3200-resize-partition.sh | 8 +-
tests/t3200-type-change.sh | 6 +-
tests/t3210-gpt-type-change.sh | 6 +-
tests/t3300-palo-prep.sh | 6 +-
tests/t3400-whole-disk-FAT-partition.sh | 2 +-
tests/t4300-nilfs2-tiny.sh | 2 +-
tests/t5000-tags.sh | 2 +-
tests/t6002-dm-busy.sh | 2 +-
tests/t9022-one-unit-snap.sh | 4 +-
tests/t9024-msdos-1s-partition.sh | 4 +-
tests/t9025-gpt-1s-partition.sh | 4 +-
tests/t9040-many-partitions.sh | 2 +-
.../t9041-undetected-in-use-16th-partition.sh | 4 +-
tests/t9042-dos-partition-limit.sh | 2 +-
46 files changed, 458 insertions(+), 64 deletions(-)
create mode 100755 tests/t0920-uuid-gpt.sh
create mode 100755 tests/t0921-uuid-gpt-reproducible.sh
diff --git a/NEWS b/NEWS
index c359221..bb94c24 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,9 @@ GNU parted NEWS -*- outline -*-
* Noteworthy changes in release ?.? (????-??-??) [?]
+** New Features
+
+ Add disk_uuid and uuid commands to set disk and partition UUIDs on GPT.
* Noteworthy changes in release 3.8 (2026-09-23) [stable]
diff --git a/doc/C/parted.8 b/doc/C/parted.8
index 40e6212..42f2d75 100644
--- a/doc/C/parted.8
+++ b/doc/C/parted.8
@@ -138,6 +138,10 @@ On MS-DOS set the type aka. partition id of \fIpartition\fP to
\fIid\fP. The \fIid\fP is a value between "0x01" and "0xff". On GPT
the type-uuid of \fIpartition\fP to \fIuuid\fP.
.TP
+.B uuid \fIpartition\fP \fIuuid\fP
+Set the UUID of \fIpartition\fP to \fIuuid\fP. This will only work if
+the disk label supports it (currently GPT).
+.TP
.B disk_set \fIflag\fP \fIstate\fP
Change a \fIflag\fP on the disk to \fIstate\fP. A flag can be either "on" or
"off". Some or all of these flags will be available, depending on what disk
@@ -147,6 +151,10 @@ boot flag on the GPT's protective MBR partition.
.B disk_toggle \fIflag\fP
Toggle the state of the disk \fIflag\fP.
.TP
+.B disk_uuid \fIuuid\fP
+Set the UUID of the disk to \fIuuid\fP. This will only work if the disk
+label supports it (currently GPT).
+.TP
.B version
Display version information and a copyright message.
.RE
diff --git a/doc/parted.texi b/doc/parted.texi
index 10a576b..77bef26 100644
--- a/doc/parted.texi
+++ b/doc/parted.texi
@@ -454,6 +454,7 @@ GNU Parted provides the following commands:
* align-check::
* disk_set::
* disk_toggle::
+* disk_uuid::
* help::
* mklabel::
* mkpart::
@@ -468,6 +469,7 @@ GNU Parted provides the following commands:
* toggle::
* type::
* unit::
+* uuid::
@end menu
Note that after version 2.4, the following commands were removed:
@@ -540,6 +542,25 @@ Set the PMBR's boot flag.
Toggle the state of the disk flag.
@end deffn
+ at node disk_uuid
+ at subsection disk_uuid
+ at cindex disk_uuid, command description
+ at cindex command description, disk_uuid
+
+ at deffn Command disk_uuid @var{uuid}
+
+Set the UUID of the disk to @var{uuid}. This will only work if the disk
+label supports it (currently GPT). The @var{uuid} is a 36-character string in
+standard UUID format.
+
+Example:
+
+ at example
+(parted) @kbd{disk_uuid 12345678-abcd-1234-abcd-1234567890ab}
+ at end example
+
+ at end deffn
+
@node help
@subsection help
@cindex help, command description
@@ -1182,6 +1203,25 @@ Number Start End Size Type File system Flags
@end deffn
+ at node uuid
+ at subsection uuid
+ at cindex uuid, command description
+ at cindex command description, uuid
+
+ at deffn Command uuid @var{number} @var{uuid}
+
+Set the UUID of partition @var{number} to @var{uuid}. This will only work
+if the disk label supports it (currently GPT). The @var{uuid} is a
+36-character string in standard UUID format.
+
+Example:
+
+ at example
+(parted) @kbd{uuid 1 12345678-abcd-1234-abcd-1234567890ab}
+ at end example
+
+ at end deffn
+
@node Related information
@chapter Related information
@cindex further reading
diff --git a/include/parted/disk.in.h b/include/parted/disk.in.h
index e2ee7ca..789ddfb 100644
--- a/include/parted/disk.in.h
+++ b/include/parted/disk.in.h
@@ -231,7 +231,10 @@ struct _PedDiskOps {
int (*disk_is_flag_available) (
const PedDisk *disk,
PedDiskFlag flag);
+
+ int (*disk_set_uuid) (PedDisk* disk, const uint8_t* uuid);
uint8_t* (*disk_get_uuid) (const PedDisk* disk);
+
/** \todo add label guessing op here */
/* partition operations */
@@ -264,6 +267,7 @@ struct _PedDiskOps {
int (*partition_set_type_uuid) (PedPartition* part, const uint8_t* uuid);
uint8_t* (*partition_get_type_uuid) (const PedPartition* part);
+ int (*partition_set_uuid) (PedPartition* part, const uint8_t* uuid);
uint8_t* (*partition_get_uuid) (const PedPartition* part);
int (*partition_align) (PedPartition* part,
@@ -337,6 +341,7 @@ extern int ped_disk_set_flag(PedDisk *disk, PedDiskFlag flag, int state);
extern int ped_disk_get_flag(const PedDisk *disk, PedDiskFlag flag);
extern int ped_disk_is_flag_available(const PedDisk *disk, PedDiskFlag flag);
+extern int ped_disk_set_uuid (PedDisk* disk, const uint8_t* uuid);
extern uint8_t* ped_disk_get_uuid (const PedDisk* disk);
extern const char *ped_disk_flag_get_name(PedDiskFlag flag);
@@ -375,6 +380,7 @@ extern uint8_t ped_partition_get_type_id (const PedPartition* part);
extern int ped_partition_set_type_uuid (PedPartition* part, const uint8_t* uuid);
extern uint8_t* ped_partition_get_type_uuid (const PedPartition* part);
+extern int ped_partition_set_uuid (PedPartition* part, const uint8_t* uuid);
extern uint8_t* ped_partition_get_uuid (const PedPartition* part);
extern int ped_partition_is_busy (const PedPartition* part);
diff --git a/libparted/disk.c b/libparted/disk.c
index f1da6c4..e0cf3d9 100644
--- a/libparted/disk.c
+++ b/libparted/disk.c
@@ -906,6 +906,22 @@ _assert_disk_uuid_feature (const PedDiskType* disk_type)
return 1;
}
+/**
+ * Set the uuid of the disk \p disk. This will only work if the disk label
+ * supports it.
+ */
+int
+ped_disk_set_uuid (PedDisk *disk, const uint8_t* uuid)
+{
+ PED_ASSERT (disk != NULL);
+
+ if (!_assert_disk_uuid_feature (disk->type))
+ return 0;
+
+ PED_ASSERT (disk->type->ops->disk_set_uuid != NULL);
+ return disk->type->ops->disk_set_uuid (disk, uuid);
+}
+
/**
* Get the uuid of the disk \p disk. This will only work if the disk label
* supports it.
@@ -1663,6 +1679,24 @@ ped_partition_get_type_uuid (const PedPartition *part)
return part->disk->type->ops->partition_get_type_uuid (part);
}
+/**
+ * Set the part-uuid of the partition \p part. This will only work if the disk label
+ * supports it.
+ */
+int
+ped_partition_set_uuid (PedPartition *part, const uint8_t* uuid)
+{
+ PED_ASSERT (part != NULL);
+ PED_ASSERT (part->disk != NULL);
+ PED_ASSERT (ped_partition_is_active (part));
+
+ if (!_assert_partition_uuid_feature (part->disk->type))
+ return 0;
+
+ PED_ASSERT (part->disk->type->ops->partition_set_uuid != NULL);
+ return part->disk->type->ops->partition_set_uuid (part, uuid);
+}
+
/**
* Get the uuid of the partition \p part. This will only work if the disk label
* supports it.
diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
index 5a48b9b..d63482f 100644
--- a/libparted/labels/gpt.c
+++ b/libparted/labels/gpt.c
@@ -1578,6 +1578,25 @@ gpt_disk_is_flag_available(const PedDisk *disk, PedDiskFlag flag)
}
}
+
+static int
+gpt_disk_set_uuid (PedDisk *disk, const uint8_t *uuid)
+{
+ GPTDiskData *gpt_disk_data = disk->disk_specific;
+
+ efi_guid_t* disk_uuid = &gpt_disk_data->uuid;
+ memcpy(disk_uuid, uuid, sizeof (efi_guid_t));
+
+ /* disk_uuid is always LE, while uint8_t is always kind of BE */
+
+ disk_uuid->time_low = PED_SWAP32(disk_uuid->time_low);
+ disk_uuid->time_mid = PED_SWAP16(disk_uuid->time_mid);
+ disk_uuid->time_hi_and_version = PED_SWAP16(disk_uuid->time_hi_and_version);
+
+ return 1;
+}
+
+
static uint8_t*
gpt_disk_get_uuid (const PedDisk *disk)
{
@@ -1790,6 +1809,25 @@ gpt_partition_get_type_uuid (const PedPartition *part)
return buf;
}
+
+static int
+gpt_partition_set_uuid (PedPartition *part, const uint8_t *uuid)
+{
+ GPTPartitionData *gpt_part_data = part->disk_specific;
+
+ efi_guid_t* part_uuid = &gpt_part_data->uuid;
+ memcpy(part_uuid, uuid, sizeof (efi_guid_t));
+
+ /* part_uuid is always LE, while uint8_t is always kind of BE */
+
+ part_uuid->time_low = PED_SWAP32(part_uuid->time_low);
+ part_uuid->time_mid = PED_SWAP16(part_uuid->time_mid);
+ part_uuid->time_hi_and_version = PED_SWAP16(part_uuid->time_hi_and_version);
+
+ return 1;
+}
+
+
static uint8_t*
gpt_partition_get_uuid (const PedPartition *part)
{
@@ -1907,10 +1945,12 @@ static PedDiskOps gpt_disk_ops =
partition_get_type_id: NULL,
partition_set_type_uuid: gpt_partition_set_type_uuid,
partition_get_type_uuid: gpt_partition_get_type_uuid,
+ partition_set_uuid: gpt_partition_set_uuid,
partition_get_uuid: gpt_partition_get_uuid,
disk_set_flag: gpt_disk_set_flag,
disk_get_flag: gpt_disk_get_flag,
disk_is_flag_available: gpt_disk_is_flag_available,
+ disk_set_uuid: gpt_disk_set_uuid,
disk_get_uuid: gpt_disk_get_uuid,
PT_op_function_initializers (gpt)
diff --git a/parted/parted.c b/parted/parted.c
index f86619f..225111e 100644
--- a/parted/parted.c
+++ b/parted/parted.c
@@ -161,6 +161,7 @@ static const char* number_msg = N_(
static const char* label_type_msg_start = N_("LABEL-TYPE is one of: ");
static const char* flag_msg_start = N_("FLAG is one of: ");
static const char* disk_flag_msg_start = N_("FLAG is one of: ");
+static const char* disk_uuid_msg = N_("UUID is a UUID\n");
static const char* unit_msg_start = N_("UNIT is one of: ");
static const char* min_or_opt_msg = N_("desired alignment: minimum or optimal");
static const char* part_type_msg = N_("PART-TYPE is one of: primary, logical, "
@@ -177,6 +178,7 @@ static const char* device_msg = N_("DEVICE is usually /dev/hda or /dev/sda
static const char* name_msg = N_("NAME is any word you want\n");
static const char* type_msg = N_("TYPE_ID is a value between 0x01 and 0xff, "
"TYPE_UUID is a UUID\n");
+static const char* uuid_msg = N_("UUID is a UUID\n");
static const char* copyright_msg = N_(
"Copyright (C) 1998 - 2006 Free Software Foundation, Inc.\n"
@@ -1013,6 +1015,60 @@ error:
return 0;
}
+static int
+do_uuid (PedDevice** dev, PedDisk** diskp)
+{
+ if (!*diskp)
+ *diskp = ped_disk_new (*dev);
+ if (!*diskp)
+ goto error;
+
+ if (!ped_disk_type_check_feature((*diskp)->type, PED_DISK_TYPE_PARTITION_UUID)) {
+ ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
+ _("%s disk labels do not support partition uuid."),
+ (*diskp)->type->name);
+ goto error;
+ }
+
+ PedPartition* part = NULL;
+ if (!command_line_get_partition (_("Partition number?"), *diskp, &part))
+ goto error;
+
+ uint8_t* part_uuid = ped_partition_get_uuid (part);
+ if (!part_uuid)
+ goto error;
+
+ static char buf[UUID_STR_LEN];
+ uuid_unparse_lower (part_uuid, buf);
+ free (part_uuid);
+
+ char* input = command_line_get_word (_("Partition uuid?"), buf, NULL, 0);
+ if (!input)
+ goto error;
+
+ uuid_t tmp;
+ if (uuid_parse (input, tmp) != 0 || uuid_is_null (tmp)) {
+ ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
+ _("Invalid uuid."));
+ goto error_free_input;
+ }
+
+ if (!ped_partition_set_uuid (part, tmp))
+ goto error_free_input;
+
+ free (input);
+
+ if (!ped_disk_commit (*diskp))
+ goto error;
+ return 1;
+
+error_free_input:
+ free (input);
+error:
+ return 0;
+}
+
+
static char*
partition_print_flags (PedPartition const *part)
{
@@ -2066,6 +2122,57 @@ error:
return 0;
}
+
+static int
+do_disk_uuid(PedDevice** dev, PedDisk** diskp)
+{
+ if (!*diskp)
+ *diskp = ped_disk_new (*dev);
+ if (!*diskp)
+ goto error;
+
+ if (!ped_disk_type_check_feature((*diskp)->type, PED_DISK_TYPE_DISK_UUID)) {
+ ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
+ _("%s disk labels do not support disk uuid."),
+ (*diskp)->type->name);
+ goto error;
+ }
+
+ uint8_t* disk_uuid = ped_disk_get_uuid (*diskp);
+ if (!disk_uuid)
+ goto error;
+
+ static char buf[UUID_STR_LEN];
+ uuid_unparse_lower (disk_uuid, buf);
+ free (disk_uuid);
+
+ char* input = command_line_get_word (_("Disk uuid?"), buf, NULL, 0);
+ if (!input)
+ goto error;
+
+ uuid_t tmp;
+ if (uuid_parse (input, tmp) != 0 || uuid_is_null (tmp)) {
+ ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
+ _("Invalid uuid."));
+ goto error_free_input;
+ }
+
+ if (!ped_disk_set_uuid (*diskp, tmp))
+ goto error_free_input;
+
+ free (input);
+
+ if (!ped_disk_commit (*diskp))
+ goto error;
+ return 1;
+
+error_free_input:
+ free (input);
+error:
+ return 0;
+}
+
+
static int
do_disk_set (PedDevice** dev, PedDisk** diskp)
{
@@ -2430,6 +2537,14 @@ _("disk_toggle [FLAG] toggle the state of FLAG on "
NULL),
str_list_create (disk_flag_msg, NULL), 1));
+command_register (commands, command_create (
+ str_list_create_unique ("disk_uuid", _("disk_uuid"), NULL),
+ do_disk_uuid,
+ str_list_create (
+_("disk_uuid UUID set UUID of disk"),
+NULL),
+ str_list_create (disk_uuid_msg, NULL), 1));
+
command_register (commands, command_create (
str_list_create_unique ("set", _("set"), NULL),
do_set,
@@ -2452,10 +2567,18 @@ command_register (commands, command_create (
str_list_create_unique ("type", _("type"), NULL),
do_type,
str_list_create (
-_("type NUMBER TYPE-ID or TYPE-UUID type set TYPE-ID or TYPE-UUID of partition NUMBER"),
+_("type NUMBER TYPE-ID or TYPE-UUID set TYPE-ID or TYPE-UUID of partition NUMBER"),
NULL),
str_list_create (_(number_msg), _(type_msg), NULL), 1));
+command_register (commands, command_create (
+ str_list_create_unique ("uuid", _("uuid"), NULL),
+ do_uuid,
+ str_list_create (
+_("uuid NUMBER UUID set UUID of partition NUMBER"),
+NULL),
+ str_list_create (_(number_msg), _(uuid_msg), NULL), 1));
+
command_register (commands, command_create (
str_list_create_unique ("unit", _("unit"), NULL),
do_unit,
diff --git a/tests/Makefile.am b/tests/Makefile.am
index e6bc912..addcd29 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -44,6 +44,8 @@ TESTS = \
t0901-type-gpt-invalid.sh \
t0910-type-dos.sh \
t0911-type-dos-invalid.sh \
+ t0920-uuid-gpt.sh \
+ t0921-uuid-gpt-reproducible.sh \
t1100-busy-label.sh \
t1101-busy-partition.sh \
t1102-loop-label.sh \
diff --git a/tests/t0010-script-no-ctrl-chars.sh b/tests/t0010-script-no-ctrl-chars.sh
index 49f5b42..34af25a 100755
--- a/tests/t0010-script-no-ctrl-chars.sh
+++ b/tests/t0010-script-no-ctrl-chars.sh
@@ -29,7 +29,7 @@ parted -s $dev mklabel msdos > out 2>&1 || fail=1
compare /dev/null out || fail=1
# print partition table in --script mode
-TERM=xterm parted -m -s $dev u s p > out 2>&1 || fail=1
+TERM=xterm parted -m -s $dev unit s p > out 2>&1 || fail=1
sed "s,.*/$dev:,$dev:," out > k && mv k out || fail=1
printf "BYT;\n$dev:${n_sectors}s:file:$ss:$ss:msdos::;\n" > exp || fail=1
diff --git a/tests/t0200-gpt.sh b/tests/t0200-gpt.sh
index c1e0136..c72c55c 100755
--- a/tests/t0200-gpt.sh
+++ b/tests/t0200-gpt.sh
@@ -35,7 +35,7 @@ dd if=$dev of=before count=1 skip=1 || fail=1
printf x >> $dev || fail=1
# use parted simply to print the partition table
-parted -m -s $dev u s p > out 2> err || fail=1
+parted -m -s $dev unit s print > out 2> err || fail=1
# don't bother comparing stdout
# expect no stderr
compare /dev/null err || fail=1
diff --git a/tests/t0203-gpt-shortened-device-primary-valid.sh b/tests/t0203-gpt-shortened-device-primary-valid.sh
index 6bb1dd9..f718388 100755
--- a/tests/t0203-gpt-shortened-device-primary-valid.sh
+++ b/tests/t0203-gpt-shortened-device-primary-valid.sh
@@ -27,7 +27,7 @@ parted -s -- $dev mklabel gpt || fail=1
# Chop off the last two sectors.
dd if=/dev/null of=$dev bs=$ss seek=98 || fail=1
printf 'ignore\nok\n' > in
-parted -m ---pretend-input-tty $dev u s p < in > out 2> err || fail=1
+parted -m ---pretend-input-tty $dev unit s p < in > out 2> err || fail=1
# Remove abs name of $dev_file.
sed "s, [^ ]*/$dev, $dev," err > k && mv k err || fail=1
diff --git a/tests/t0203-gpt-tiny-device-abort.sh b/tests/t0203-gpt-tiny-device-abort.sh
index 1fb3bf2..9819e9b 100644
--- a/tests/t0203-gpt-tiny-device-abort.sh
+++ b/tests/t0203-gpt-tiny-device-abort.sh
@@ -35,7 +35,7 @@ for i in 33 34 35 67 68 69 101 102 103; do
# Print the partition table. Before, this would evoke a failed assertion.
printf 'i\no\n' > in
- parted ---pretend-input-tty bad u s p < in > out 2> err || { fail=1; cat err; }
+ parted ---pretend-input-tty bad unit s print < in > out 2> err || { fail=1; cat err; }
# don't bother comparing stdout
done
diff --git a/tests/t0205-gpt-list-clobbers-pmbr.sh b/tests/t0205-gpt-list-clobbers-pmbr.sh
index c4f7b5b..fadab5c 100644
--- a/tests/t0205-gpt-list-clobbers-pmbr.sh
+++ b/tests/t0205-gpt-list-clobbers-pmbr.sh
@@ -32,7 +32,7 @@ parted -s $dev mkpart p1 101s 150s || fail=1
parted -s $dev mkpart p2 151s 200s || fail=1
parted -s $dev mkpart p3 201s 250s || fail=1
-parted -m -s $dev u s p || fail=1
+parted -m -s $dev unit s p || fail=1
# Write non-NUL bytes all over the MBR, so we're likely to see any change.
# However, be careful to leave the type of the first partition, 0xEE,
@@ -42,7 +42,7 @@ printf '%0450d\xee%059d\x55\xaa' 0 0 | dd of=$dev count=1 conv=notrunc || fail=1
dd if=$dev of=before count=1 || fail=1
chmod a-w $dev
-parted -m -s $dev u s p || fail=1
+parted -m -s $dev unit s p || fail=1
dd if=$dev of=after count=1 || fail=1
diff --git a/tests/t0206-gpt-print-with-corrupt-primary-clobbers-pmbr.sh b/tests/t0206-gpt-print-with-corrupt-primary-clobbers-pmbr.sh
index 6a7e522..56444d9 100755
--- a/tests/t0206-gpt-print-with-corrupt-primary-clobbers-pmbr.sh
+++ b/tests/t0206-gpt-print-with-corrupt-primary-clobbers-pmbr.sh
@@ -28,7 +28,7 @@ dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1
parted -s $dev mklabel gpt || fail=1
parted -s $dev mkpart p1 128s 255s || fail=1
-parted -m -s $dev u s p || fail=1
+parted -m -s $dev unit s print || fail=1
# Write non-NUL bytes all over the MBR, so we're likely to see any change.
# However, be careful to leave the type of the first partition, 0xEE,
@@ -39,7 +39,7 @@ dd if=$dev of=before count=1 || fail=1
orig_byte=$(gpt_corrupt_primary_table_ $dev $ss) || fail=1
-parted -m -s $dev u s p || fail=1
+parted -m -s $dev unit s print || fail=1
dd if=$dev of=after count=1 || fail=1
diff --git a/tests/t0207-IEC-binary-notation.sh b/tests/t0207-IEC-binary-notation.sh
index 17a7505..9898a7e 100644
--- a/tests/t0207-IEC-binary-notation.sh
+++ b/tests/t0207-IEC-binary-notation.sh
@@ -26,7 +26,7 @@ dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1
parted --align=none -s $dev mklabel gpt mkpart p1 $((64*1024))B $((1024*1024-$ss))B \
> err 2>&1 || fail=1
compare /dev/null err || fail=1
-parted -m -s $dev u s p > exp || fail=1
+parted -m -s $dev unit s p > exp || fail=1
# Test using MiB
rm $dev
@@ -34,7 +34,7 @@ dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1
parted --align=none -s $dev mklabel gpt mkpart p1 64KiB 1MiB \
> err 2>&1 || fail=1
compare /dev/null err || fail=1
-parted -m -s $dev u s p > out || fail=1
+parted -m -s $dev unit s p > out || fail=1
compare exp out || fail=1
@@ -44,7 +44,7 @@ dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1
parted --align=none -s $dev mklabel gpt mkpart p1 64kib 1mib \
> err 2>&1 || fail=1
compare /dev/null err || fail=1
-parted -m -s $dev u s p > out || fail=1
+parted -m -s $dev unit s p > out || fail=1
compare exp out || fail=1
@@ -54,7 +54,7 @@ dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1
parted --align=none -s $dev mklabel gpt mkpart p1 64KiB 1024KiB \
> err 2>&1 || fail=1
compare /dev/null err || fail=1
-parted -m -s $dev u s p > out || fail=1
+parted -m -s $dev unit s p > out || fail=1
compare exp out || fail=1
@@ -64,7 +64,7 @@ dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1
parted --align=none -s $dev mklabel gpt mkpart p1 64kiB 1024kiB \
> err 2>&1 || fail=1
compare /dev/null err || fail=1
-parted -m -s $dev u s p > out || fail=1
+parted -m -s $dev unit s p > out || fail=1
compare exp out || fail=1
diff --git a/tests/t0208-mkpart-end-in-IEC.sh b/tests/t0208-mkpart-end-in-IEC.sh
index 140bbbb..0ed7bbe 100644
--- a/tests/t0208-mkpart-end-in-IEC.sh
+++ b/tests/t0208-mkpart-end-in-IEC.sh
@@ -27,7 +27,7 @@ dd if=/dev/null of=$dev bs=1M seek=$n_mbs || fail=1
# create 1st partition
parted --align=none -s $dev mklabel gpt mkpart p1 1MiB 2048KiB > err 2>&1 || fail=1
compare /dev/null err || fail=1 # expect no output
-#parted -m -s $dev u s p > exp || fail=1
+#parted -m -s $dev unit s p > exp || fail=1
# create 2nd partition - they should not overlap
# this time specify default unit
@@ -44,7 +44,7 @@ parted --align=none -s $dev unit MiB mkpart p4 4MiB 10239s > err 2>&1 || fail=1
compare /dev/null err || fail=1 # expect no output
# check boundaries of the partitions
-parted -m -s $dev u s p > out || fail=1
+parted -m -s $dev unit s p > out || fail=1
# prepare expected output
cat <<EOF > exp || framework_failure
diff --git a/tests/t0209-gpt-pmbr_boot.sh b/tests/t0209-gpt-pmbr_boot.sh
index 2ab5551..2683e57 100755
--- a/tests/t0209-gpt-pmbr_boot.sh
+++ b/tests/t0209-gpt-pmbr_boot.sh
@@ -32,7 +32,7 @@ compare /dev/null out || fail=1
parted -s $dev disk_set pmbr_boot on
# Check to see if the flag is set
-parted -m -s $dev u s p > out 2> err || fail=1
+parted -m -s $dev unit s p > out 2> err || fail=1
grep "$dev:.*:gpt::pmbr_boot;" out || { cat out; fail=1; }
Exit $fail
diff --git a/tests/t0210-gpt-resized-partition-entry-array.sh b/tests/t0210-gpt-resized-partition-entry-array.sh
index 27303cd..3bcdc50 100755
--- a/tests/t0210-gpt-resized-partition-entry-array.sh
+++ b/tests/t0210-gpt-resized-partition-entry-array.sh
@@ -36,7 +36,7 @@ compare /dev/null out || fail=1
gpt-header-munge --sector-size=$ss --n=9 $dev || fail=1
-parted -m -s $dev u s p > out 2>&1 || fail=1
+parted -m -s $dev unit s print > out 2>&1 || fail=1
sed 's/.*:gpt:/:gpt:/' out > k && mv k out
printf 'BYT;\n:gpt::;\n' > exp || fail=1
compare exp out || fail=1
diff --git a/tests/t0211-gpt-rewrite-header.sh b/tests/t0211-gpt-rewrite-header.sh
index fc3462b..6f44974 100644
--- a/tests/t0211-gpt-rewrite-header.sh
+++ b/tests/t0211-gpt-rewrite-header.sh
@@ -58,7 +58,7 @@ dd if=/dev/null of=$dev bs=$ss seek=$ns2 || fail=1
printf '%s\n' f f > in || fail=1
# This would always succeed, even before.
-parted ---pretend-input-tty $dev u s p < in || fail=1
+parted ---pretend-input-tty $dev unit s p < in || fail=1
printf '%s\n' \
'BYT;' \
@@ -75,7 +75,7 @@ printf '%s\n' \
> exp || fail=1
# Before parted-3.1, this would fail, reporting that both tables are corrupt.
-parted -m -s $dev u s p > out 2>&1 || fail=1
+parted -m -s $dev unit s p > out 2>&1 || fail=1
sed '2s/^[^:]*:/...:/' out > k && mv k out
compare exp out || fail=1
diff --git a/tests/t0212-gpt-many-partitions.sh b/tests/t0212-gpt-many-partitions.sh
index b880643..d13dd5d 100644
--- a/tests/t0212-gpt-many-partitions.sh
+++ b/tests/t0212-gpt-many-partitions.sh
@@ -36,7 +36,7 @@ while :; do
cmd="$cmd mkpart p$i ${s}s ${s}s"
test $i = $n_partitions && break; i=$((i+1))
done
-parted -m -a min -s $dev mklabel gpt $cmd u s p > out 2>&1 || fail=1
+parted -m -a min -s $dev mklabel gpt $cmd unit s p > out 2>&1 || fail=1
nl='
'
diff --git a/tests/t0213-mkpart-start-negative.sh b/tests/t0213-mkpart-start-negative.sh
index ad72018..a09fed1 100755
--- a/tests/t0213-mkpart-start-negative.sh
+++ b/tests/t0213-mkpart-start-negative.sh
@@ -33,7 +33,7 @@ parted --align=none -s $dev -- mkpart p2 -6MiB -5MiB > err 2>&1 || fail=1
compare /dev/null err || fail=1 # expect no output
# check boundaries of the partitions
-parted -m -s $dev u s p > out || fail=1
+parted -m -s $dev unit s p > out || fail=1
# prepare expected output
cat <<EOF > exp || framework_failure
diff --git a/tests/t0220-gpt-msftres.sh b/tests/t0220-gpt-msftres.sh
index d6c7a85..7e9ee50 100755
--- a/tests/t0220-gpt-msftres.sh
+++ b/tests/t0220-gpt-msftres.sh
@@ -71,7 +71,7 @@ for type in $fs_types; do
done
# print partition table
-parted -m -s $dev u s p > out 2>&1 || fail=1
+parted -m -s $dev unit s print > out 2>&1 || fail=1
sed "s,.*/$dev:,$dev:," out > k && mv k out && ok=1 || ok=0
# match against expected output
diff --git a/tests/t0280-gpt-corrupt.sh b/tests/t0280-gpt-corrupt.sh
index f93022b..db4a9f8 100755
--- a/tests/t0280-gpt-corrupt.sh
+++ b/tests/t0280-gpt-corrupt.sh
@@ -86,7 +86,7 @@ echo 'Error: The backup GPT table is corrupt, but the primary appears OK,' \
compare exp err || fail=1
# corruption is fixed; printing the table now elicits no diagnostic
-parted -m -s $dev u s print > out 2>&1 || fail=1
+parted -m -s $dev unit s print > out 2>&1 || fail=1
# check for expected output
printf "BYT;\nfile\n1:2048s:4095s:2048s::foo:swap;\n" > exp || fail=1
diff --git a/tests/t0350-mac-PT-increases-sector-size.sh b/tests/t0350-mac-PT-increases-sector-size.sh
index 4bb6828..bf3d886 100644
--- a/tests/t0350-mac-PT-increases-sector-size.sh
+++ b/tests/t0350-mac-PT-increases-sector-size.sh
@@ -40,7 +40,7 @@ BYT;
FILE:2000s:file:1024:512:unknown::;
EOF
-parted -m ---pretend-input-tty $dev u s p < in > err 2>&1 || fail=1
+parted -m ---pretend-input-tty $dev unit s p < in > err 2>&1 || fail=1
sed 's,
*
,,g;s!^/[^:]*:!FILE:!' err \
| grep -Evi '^(ignore|fix|error|warning)' \
> k && mv k err || fail=1
diff --git a/tests/t0920-uuid-gpt.sh b/tests/t0920-uuid-gpt.sh
new file mode 100755
index 0000000..88ef8e0
--- /dev/null
+++ b/tests/t0920-uuid-gpt.sh
@@ -0,0 +1,92 @@
+#!/bin/sh
+
+# Test disk_uuid and uuid commands with GPT label
+
+# Copyright (C) 2026 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+# Force 512-byte sector size for this test
+export PARTED_SECTOR_SIZE=512
+sector_size_=512
+
+dev=loop-file
+
+# create image
+truncate --size 50MiB "$dev" || fail=1
+
+# create gpt label and one partition
+parted --script "$dev" mklabel gpt > out 2>&1 || fail=1
+parted --script "$dev" mkpart "test1" ext4 10% 20% > out 2>&1 || fail=1
+
+# set disk uuid and partition uuid
+parted --script "$dev" disk_uuid "351df77b-cfce-40fe-8fb2-3fb09ea36b4f" || fail=1
+parted --script "$dev" uuid 1 "f92e01b5-be06-4e95-8957-e97db3be2db1" || fail=1
+
+# print with json format (without replacing UUIDs since they are deterministic)
+parted --script --json "$dev" unit s print > out 2>&1 || fail=1
+
+cat <<EOF > exp || fail=1
+{
+ "disk": {
+ "path": "loop-file",
+ "size": "102400s",
+ "model": "",
+ "transport": "file",
+ "logical-sector-size": 512,
+ "physical-sector-size": 512,
+ "label": "gpt",
+ "uuid": "351df77b-cfce-40fe-8fb2-3fb09ea36b4f",
+ "max-partitions": 128,
+ "partitions": [
+ {
+ "number": 1,
+ "start": "10240s",
+ "end": "20479s",
+ "size": "10240s",
+ "type": "primary",
+ "type-uuid": "0fc63daf-8483-4772-8e79-3d69d8477de4",
+ "uuid": "f92e01b5-be06-4e95-8957-e97db3be2db1",
+ "name": "test1"
+ }
+ ]
+ }
+}
+EOF
+
+# remove full path of device from actual output
+mv out o2 && sed "s,\"/.*/$dev\",\"$dev\"," o2 > out || fail=1
+
+# check for expected output
+compare exp out || fail=1
+
+# test invalid UUIDs
+parted --script "$dev" disk_uuid "invalid-uuid" && fail=1
+parted --script "$dev" disk_uuid "00000000-0000-0000-0000-000000000000" && fail=1
+parted --script "$dev" uuid 1 "invalid-uuid" && fail=1
+parted --script "$dev" uuid 1 "00000000-0000-0000-0000-000000000000" && fail=1
+
+# test non-existent partition
+parted --script "$dev" uuid 2 "704cee3d-3d76-4450-8ed7-3b283325a526" && fail=1
+
+# test unsupported label (msdos)
+dev_msdos=loop-msdos
+truncate --size 20MiB "$dev_msdos" || fail=1
+parted --script "$dev_msdos" disk_uuid "67261cd9-da45-437e-a57c-c2250d0a1aa1" && fail=1
+parted --script "$dev_msdos" mklabel msdos mkpart primary ext4 1MiB 5MiB || fail=1
+parted --script "$dev_msdos" uuid 1 "14a812a3-0633-4069-bd19-79eb6f8fe8b1" && fail=1
+
+Exit $fail
diff --git a/tests/t0921-uuid-gpt-reproducible.sh b/tests/t0921-uuid-gpt-reproducible.sh
new file mode 100755
index 0000000..371407d
--- /dev/null
+++ b/tests/t0921-uuid-gpt-reproducible.sh
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+# Test reproducible GPT creation using disk_uuid and uuid commands
+
+# Copyright (C) 2026 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+# Force 512-byte sector size for this test
+export PARTED_SECTOR_SIZE=512
+sector_size_=512
+
+sha256sum --version >/dev/null 2>&1 || skip_ "sha256sum is required for this test"
+
+dev=dev.img
+
+# create zeroed image
+truncate --size 50MiB "$dev" || fail=1
+
+# create gpt label, two partition, and set all UUIDs
+parted --script "$dev" mklabel gpt \
+ disk_uuid "d812fb48-9902-49a1-856a-eee66da8b826" || fail=1
+parted --script "$dev" mkpart "test1" ext4 2048s 10239s \
+ uuid 1 "7b492910-2456-4e62-80aa-0d877df63323" || fail=1
+parted --script "$dev" mkpart "test2" ext4 10240s 20479s \
+ uuid 2 "207d63b5-f9ec-4240-aa00-2fce00656723" || fail=1
+
+# verify exact sha256 checksum for reproducible builds
+sha256sum "$dev" > out || fail=1
+echo "837f295e07a0f0333b142ceb3f6a94d67c7312862615ebd272941c6ad3eb4cdd $dev" > exp || fail=1
+compare exp out || fail=1
+
+Exit $fail
diff --git a/tests/t1100-busy-label.sh b/tests/t1100-busy-label.sh
index 71999b7..805e507 100755
--- a/tests/t1100-busy-label.sh
+++ b/tests/t1100-busy-label.sh
@@ -53,7 +53,7 @@ compare exp out || fail=1
# on this same device is mounted (active).
parted -s "$dev" mkpart primary fat32 5 10 > out 2>&1 || fail=1
compare /dev/null out || fail=1
-parted -s "$dev" u s print
+parted -s "$dev" unit s print
# ==================================================
# Repeat the test in interactive mode.
diff --git a/tests/t1700-probe-fs.sh b/tests/t1700-probe-fs.sh
index a494e8a..5e74244 100755
--- a/tests/t1700-probe-fs.sh
+++ b/tests/t1700-probe-fs.sh
@@ -50,7 +50,7 @@ for type in ext2 ext3 ext4 btrfs xfs nilfs2 ntfs vfat hfsplus udf f2fs exfat; do
fi
# probe the $type file system
- parted -m -s $dev u s print >out 2>&1 || fail=1
+ parted -m -s $dev unit s print >out 2>&1 || fail=1
grep '^1:.*:'$fsname'::;$' out || { cat out; fail=1; }
rm $dev
done
@@ -65,7 +65,7 @@ for feature in uninit_bg flex_bg; do
tune2fs -O $feature $dev || skip_ "tune2fs failed"
# probe the file system, which should now be ext4
- parted -m -s $dev u s print >out 2>&1 || fail=1
+ parted -m -s $dev unit s print >out 2>&1 || fail=1
grep '^1:.*:ext4::;$' out || fail=1
rm $dev
done
@@ -76,7 +76,7 @@ dd if=/dev/null of=$dev bs=1024 seek=8192 >/dev/null || skip_ "dd failed"
mkfs.ext4 -O ^has_journal -F $dev >/dev/null || skip_ "mkfs.ext4 failed"
# probe the file system, which should still be ext4
-parted -m -s $dev u s print >out 2>&1 || fail=1
+parted -m -s $dev unit s print >out 2>&1 || fail=1
grep '^1:.*:ext4::;$' out || fail=1
rm $dev
diff --git a/tests/t2310-dos-extended-2-sector-min-offset.sh b/tests/t2310-dos-extended-2-sector-min-offset.sh
index 77fc51d..44347d4 100644
--- a/tests/t2310-dos-extended-2-sector-min-offset.sh
+++ b/tests/t2310-dos-extended-2-sector-min-offset.sh
@@ -40,7 +40,7 @@ EOF
# Create a DOS label with an extended partition starting at sector 64.
parted -s $scsi_dev mklabel msdos || fail=1
parted --align=min -s $scsi_dev mkpart extended 64s 128s> out 2>&1 || fail=1
-parted -m -s $scsi_dev u s print
+parted -m -s $scsi_dev unit s print
compare /dev/null out || fail=1
# Trying to create a partition that starts just
@@ -48,7 +48,7 @@ compare /dev/null out || fail=1
parted --align=min -s $scsi_dev mkpart logical 65s 128s > out 2>&1 || fail=1
compare /dev/null out || fail=1
-parted -m -s $scsi_dev u s print > out 2>&1
+parted -m -s $scsi_dev unit s print > out 2>&1
compare exp out || fail=1
Exit $fail
diff --git a/tests/t2500-probe-corrupt-hfs.sh b/tests/t2500-probe-corrupt-hfs.sh
index 8f19ad7..874dae4 100755
--- a/tests/t2500-probe-corrupt-hfs.sh
+++ b/tests/t2500-probe-corrupt-hfs.sh
@@ -27,7 +27,7 @@ dd if=/dev/null of=$dev bs=1 seek=$N || framework_failure
parted -s "$dev" mklabel gpt mkpart p1 1MiB 2MiB > out 2>&1 || fail=1
compare /dev/null out || fail=1
-parted -s "$dev" u s p || fail=1
+parted -s "$dev" unit s p || fail=1
# Poke an HFS+ signature into place
printf '\x48\x2b' | dd of=$dev seek=$((2048+2)) conv=notrunc || fail=1
@@ -36,6 +36,6 @@ printf '\x48\x2b' | dd of=$dev seek=$((2048+2)) conv=notrunc || fail=1
# offset 18 total_blocks=0(16b)
# offset 20 vh->block_size=0(32b)
-parted -s "$dev" u s p || fail=1
+parted -s "$dev" unit s p || fail=1
Exit $fail
diff --git a/tests/t3000-resize-fs.sh b/tests/t3000-resize-fs.sh
index 0051842..d6225ff 100755
--- a/tests/t3000-resize-fs.sh
+++ b/tests/t3000-resize-fs.sh
@@ -51,7 +51,7 @@ parted -s $dev mklabel gpt > out 2>&1 || fail=1
compare /dev/null out || fail=1
# ensure that the disk is large enough
-dev_n_sectors=$(parted -s $dev u s p|sed -n '2s/.* \([0-9]*\)s$/\1/p')
+dev_n_sectors=$(parted -s $dev unit s p|sed -n '2s/.* \([0-9]*\)s$/\1/p')
device_sectors_required=$(echo $default_end | sed 's/s$//')
# Ensure that $dev is large enough for this test
test $device_sectors_required -le $dev_n_sectors || fail=1
@@ -71,7 +71,7 @@ for fs_type in $FSTYPES; do
compare /dev/null out || fail=1
# print partition table
- parted -m -s $dev u s p > out 2>&1 || fail=1
+ parted -m -s $dev unit s p > out 2>&1 || fail=1
# wait for new partition device to appear
wait_for_dev_to_appear_ ${dev}1
diff --git a/tests/t3001-buffer.sh b/tests/t3001-buffer.sh
index c016f5f..0f6dfba 100755
--- a/tests/t3001-buffer.sh
+++ b/tests/t3001-buffer.sh
@@ -48,7 +48,7 @@ parted -s $dev mklabel gpt > out 2>&1 || fail=1
compare /dev/null out || fail=1
# ensure that the disk is large enough
-dev_n_sectors=$(parted -s $dev u s p|sed -n '2s/.* \([0-9]*\)s$/\1/p')
+dev_n_sectors=$(parted -s $dev unit s p|sed -n '2s/.* \([0-9]*\)s$/\1/p')
device_sectors_required=$(echo $default_end | sed 's/s$//')
# Ensure that $dev is large enough for this test
test $device_sectors_required -le $dev_n_sectors || fail=1
@@ -68,7 +68,7 @@ for fs_type in $FSTYPES; do
compare /dev/null out || fail=1
# print partition table
- parted -m -s $dev u s p > out 2>&1 || fail=1
+ parted -m -s $dev unit s p > out 2>&1 || fail=1
# wait for new partition device to appear
wait_for_dev_to_appear_ ${dev}1
diff --git a/tests/t3200-resize-partition.sh b/tests/t3200-resize-partition.sh
index 9b178e2..533dabe 100755
--- a/tests/t3200-resize-partition.sh
+++ b/tests/t3200-resize-partition.sh
@@ -45,7 +45,7 @@ compare /dev/null out || fail=1
compare /dev/null err || fail=1
# ensure that the disk is large enough
-dev_n_sectors=$(parted -s $dev u s p|sed -n '2s/.* \([0-9]*\)s$/\1/p')
+dev_n_sectors=$(parted -s $dev unit s p|sed -n '2s/.* \([0-9]*\)s$/\1/p')
device_sectors_required=$(echo $default_end | sed 's/s$//')
# Ensure that $dev is large enough for this test
test $device_sectors_required -le $dev_n_sectors || fail=1
@@ -55,7 +55,7 @@ parted -a minimal -s $dev mkpart primary $default_start $default_end > out 2>&1
compare /dev/null out || fail=1
# print partition table
-parted -m -s $dev u s p > out 2>&1 || fail=1
+parted -m -s $dev unit s p > out 2>&1 || fail=1
# FIXME: check expected output
@@ -74,7 +74,7 @@ compare /dev/null out || fail=1
compare /dev/null err || fail=1
# print partition table
-parted -m -s $dev u s p > out 2>&1 || fail=1
+parted -m -s $dev unit s p > out 2>&1 || fail=1
sed -n 3p out > k && mv k out || fail=1
printf "1:$default_start:$new_end:1025s:::$ms;\n" > exp || fail=1
@@ -108,7 +108,7 @@ mv out o2 && sed -e "s,
*
,,g;s, $,," o2 > out
compare exp out || fail=1
# print partition table
-parted -m -s $dev u s p > out 2>&1 || fail=1
+parted -m -s $dev unit s p > out 2>&1 || fail=1
sed -n 3p out > k && mv k out || fail=1
printf "1:$default_start:$new_end:3073s:ext4::$ms;\n" > exp || fail=1
diff --git a/tests/t3200-type-change.sh b/tests/t3200-type-change.sh
index 3f0d142..0257cfa 100755
--- a/tests/t3200-type-change.sh
+++ b/tests/t3200-type-change.sh
@@ -36,7 +36,7 @@ scsi_dev=$(cat dev-name)
parted -s $scsi_dev mklabel msdos mkpart primary fat32 1MiB 100% || fail=1
-parted -s $scsi_dev u s p
+parted -s $scsi_dev unit s p
p1=${scsi_dev}1
wait_for_dev_to_appear_ $p1 || fail=1
@@ -53,7 +53,7 @@ case $type in
*) fail_ "expected initial type of 0c (FAT32)";;
esac
-parted -s $scsi_dev u s p
+parted -s $scsi_dev unit s p
parted -s $scsi_dev set 1 lvm off || fail=1
# Before parted-2.1, the above would mistakenly change it to 0x83,
@@ -67,7 +67,7 @@ esac
# Ensure that setting the "lvm" flag still works.
parted -s $scsi_dev set 1 lvm on || fail=1
-parted -s $scsi_dev u s p > out || fail=1
+parted -s $scsi_dev unit s p > out || fail=1
grep lvm out || { fail=1; cat out; }
Exit $fail
diff --git a/tests/t3210-gpt-type-change.sh b/tests/t3210-gpt-type-change.sh
index 1328322..716f833 100755
--- a/tests/t3210-gpt-type-change.sh
+++ b/tests/t3210-gpt-type-change.sh
@@ -67,7 +67,7 @@ for fs_type in $FSTYPES; do
esac
# Confirm the filesystem and flags are as expected
- parted -s $scsi_dev u s p > out || fail=1
+ parted -s $scsi_dev unit s print > out || fail=1
case $fs_type in
fat32) grep 'fat16.*msftdata$' out || { fail=1; cat out; } ;;
hfs*) grep 'hfs+.*first$' out || { fail=1; cat out; } ;;
@@ -81,7 +81,7 @@ for fs_type in $FSTYPES; do
compare /dev/null out || fail=1
# Confirm filesystem probe is the same, but flags are now lvm
- parted -s $scsi_dev u s p > out || fail=1
+ parted -s $scsi_dev unit s print > out || fail=1
case $fs_type in
fat32) grep 'fat16.*lvm$' out || { fail=1; cat out; } ;;
hfs*) grep 'hfs+.*lvm$' out || { fail=1; cat out; } ;;
@@ -95,7 +95,7 @@ for fs_type in $FSTYPES; do
compare /dev/null out || fail=1
# Confirm the filesystem and flags are as expected
- parted -s $scsi_dev u s p > out || fail=1
+ parted -s $scsi_dev unit s print > out || fail=1
case $fs_type in
fat32) grep 'fat16.*msftdata$' out || { fail=1; cat out; } ;;
hfs*) grep 'hfs+.*first$' out || { fail=1; cat out; } ;;
diff --git a/tests/t3300-palo-prep.sh b/tests/t3300-palo-prep.sh
index ff18530..4da976c 100755
--- a/tests/t3300-palo-prep.sh
+++ b/tests/t3300-palo-prep.sh
@@ -32,9 +32,9 @@ dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1
parted -m -s $dev mklabel msdos \
mkpart pri ext2 $((1*2048))s $((2*2048-1))s \
- set 1 palo on u s print \
- set 1 prep on u s print \
- set 1 palo on u s print \
+ set 1 palo on unit s print \
+ set 1 prep on unit s print \
+ set 1 palo on unit s print \
> out 2> err || fail=1
grep -E '^1:2048s:4095s:2048s:ext2::p...;$' out > k; mv k out
diff --git a/tests/t3400-whole-disk-FAT-partition.sh b/tests/t3400-whole-disk-FAT-partition.sh
index 4726741..17a4e76 100755
--- a/tests/t3400-whole-disk-FAT-partition.sh
+++ b/tests/t3400-whole-disk-FAT-partition.sh
@@ -25,7 +25,7 @@ echo '1:0s:81919s:81920s:fat16::;' > exp || framework_failure_
dd if=/dev/null of=$dev_file bs=1 seek=40M || framework_failure_
mkfs.vfat -F 16 $dev_file || skip_ "mkfs.vfat failed"
-parted -m -s $dev_file u s print > out 2>&1 || fail=1
+parted -m -s $dev_file unit s print > out 2>&1 || fail=1
grep '^1:' out > k; mv k out
compare exp out || fail=1
diff --git a/tests/t4300-nilfs2-tiny.sh b/tests/t4300-nilfs2-tiny.sh
index 01e84e1..dcd4028 100755
--- a/tests/t4300-nilfs2-tiny.sh
+++ b/tests/t4300-nilfs2-tiny.sh
@@ -27,6 +27,6 @@ dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || framework_failure_
parted -s $dev mklabel gpt mkpart p1 64s 70s || framework_failure_
# This used to make parted abort.
-parted -s $dev u s p || fail=1
+parted -s $dev unit s p || fail=1
Exit $fail
diff --git a/tests/t5000-tags.sh b/tests/t5000-tags.sh
index 4d7ad68..0afc45f 100755
--- a/tests/t5000-tags.sh
+++ b/tests/t5000-tags.sh
@@ -48,7 +48,7 @@ printf "BYT;\n$dev:${N}s:file:$ss:$ss:gpt::;\n" > exp || fail=1
compare exp out || fail=1
# add a partition
-parted -s $dev u s mkpart name1 ${start_sector} ${end_sector} >out 2>&1 \
+parted -s $dev unit s mkpart name1 ${start_sector} ${end_sector} >out 2>&1 \
|| fail=1
# print the table before modification
diff --git a/tests/t6002-dm-busy.sh b/tests/t6002-dm-busy.sh
index d56cefd..3edd98b 100644
--- a/tests/t6002-dm-busy.sh
+++ b/tests/t6002-dm-busy.sh
@@ -77,7 +77,7 @@ parted -s "$dev" rm 1 > /dev/null 2>&1 || fail=1
# Removal of mounted partition must fail.
parted -s "$dev" rm 2 > /dev/null 2>&1 && fail=1
-parted -m -s "$dev" u s print > out 2>&1 || fail=1
+parted -m -s "$dev" unit s print > out 2>&1 || fail=1
sed "s,^$dev,DEV," out > k; mv k out
# Create expected output file.
diff --git a/tests/t9022-one-unit-snap.sh b/tests/t9022-one-unit-snap.sh
index 652c1eb..8b956fb 100644
--- a/tests/t9022-one-unit-snap.sh
+++ b/tests/t9022-one-unit-snap.sh
@@ -28,14 +28,14 @@ dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1
parted --align=none -s $dev mklabel msdos mkpart pri 1s $((1000*1000))B \
> err 2>&1 || fail=1
compare /dev/null err || fail=1
-parted -m -s $dev u s p > exp || fail=1
+parted -m -s $dev unit s p > exp || fail=1
rm $dev
dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1
parted --align=none -s $dev mklabel msdos mkpart pri 0 1MB \
> err 2>&1 || fail=1
compare /dev/null err || fail=1
-parted -m -s $dev u s p > out || fail=1
+parted -m -s $dev unit s p > out || fail=1
compare exp out || fail=1
diff --git a/tests/t9024-msdos-1s-partition.sh b/tests/t9024-msdos-1s-partition.sh
index 59ba375..8590b51 100644
--- a/tests/t9024-msdos-1s-partition.sh
+++ b/tests/t9024-msdos-1s-partition.sh
@@ -27,10 +27,10 @@ truncate --size 10MiB "$dev" || fail=1
parted --script "$dev" mklabel msdos > out 2>&1 || fail=1
parted --script "$dev" mkpart primary ext4 64s 128s > out 2>&1 || fail=1
parted --script "$dev" mkpart primary ext4 130s 200s > out 2>&1 || fail=1
-parted --script "$dev" u s p free
+parted --script "$dev" unit s print free
# Free space is at 129s
parted --script "$dev" mkpart primary ext4 129s 129s > out 2>&1 || fail=1
-parted --script "$dev" u s p free
+parted --script "$dev" unit s print free
Exit $fail
diff --git a/tests/t9025-gpt-1s-partition.sh b/tests/t9025-gpt-1s-partition.sh
index d3983ad..0d2a92d 100644
--- a/tests/t9025-gpt-1s-partition.sh
+++ b/tests/t9025-gpt-1s-partition.sh
@@ -27,10 +27,10 @@ truncate --size 10MiB "$dev" || fail=1
parted --script "$dev" mklabel gpt > out 2>&1 || fail=1
parted --script "$dev" mkpart p1 ext4 64s 128s > out 2>&1 || fail=1
parted --script "$dev" mkpart p2 ext4 130s 200s > out 2>&1 || fail=1
-parted --script "$dev" u s p free
+parted --script "$dev" unit s print free
# Free space is at 129s
parted --script "$dev" mkpart p3 ext4 129s 129s > out 2>&1 || fail=1
-parted --script "$dev" u s p free
+parted --script "$dev" unit s print free
Exit $fail
diff --git a/tests/t9040-many-partitions.sh b/tests/t9040-many-partitions.sh
index df29ffe..408a083 100644
--- a/tests/t9040-many-partitions.sh
+++ b/tests/t9040-many-partitions.sh
@@ -53,7 +53,7 @@ while :; do
done
# Time the actual command:
-parted -m -a min -s $scsi_dev mklabel gpt $cmd u s p > out 2>&1 || fail=1
+parted -m -a min -s $scsi_dev mklabel gpt $cmd unit s print > out 2>&1 || fail=1
i=1
while :; do
diff --git a/tests/t9041-undetected-in-use-16th-partition.sh b/tests/t9041-undetected-in-use-16th-partition.sh
index 09357e6..f52b390 100644
--- a/tests/t9041-undetected-in-use-16th-partition.sh
+++ b/tests/t9041-undetected-in-use-16th-partition.sh
@@ -44,7 +44,7 @@ printf "BYT;\n$scsi_dev:${n}s:scsi:$ss:$ss:gpt:Linux scsi_debug:;\n" \
> exp || fail=1
parted -s $scsi_dev mklabel gpt || fail=1
-parted -s $scsi_dev u s p || fail=1
+parted -s $scsi_dev unit s print || fail=1
i=1
t0=$(date +%s.%N)
@@ -65,7 +65,7 @@ $AWK "BEGIN {d = $t_final - $t0; n = $n_partitions; st = 60 < d;"\
' printf "created %d partitions in %.2f seconds\n", n, d; exit st }' /dev/null \
|| fail=1
-parted -m -s $scsi_dev u s p > out || fail=1
+parted -m -s $scsi_dev unit s print > out || fail=1
compare exp out || fail=1
wait_for_dev_to_appear_ ${scsi_dev}16 || fail_ ${scsi_dev}16 did not appear
diff --git a/tests/t9042-dos-partition-limit.sh b/tests/t9042-dos-partition-limit.sh
index 87a32df..7d1499e 100644
--- a/tests/t9042-dos-partition-limit.sh
+++ b/tests/t9042-dos-partition-limit.sh
@@ -57,7 +57,7 @@ while :; do
i=$((i+1))
done
-parted -m -s $scsi_dev u s p > out || fail=1
+parted -m -s $scsi_dev unit s print > out || fail=1
compare exp out || fail=1
start=$((start + partition_sectors))
--
Arvin Schnell, <aschnell at suse.com>
Senior Software Engineer, Research & Development
SUSE Software Solutions Germany GmbH
Frankenstr. 146
90461 Nürnberg
Germany
Geschäftsführer: Stefan Gaiser, Jochen Jaser, Abhinav Puri
(HRB 36809, AG Nürnberg)
More information about the parted-devel
mailing list