From e1422de3d83326b6cd6e559b0f6653a451e7ef92 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 6 Oct 2014 14:53:25 +0200 Subject: [PATCH] sfdisk: add --label-nested for hybrid GPT regular disk label: # sfdisk --list /dev/sdb .. Disklabel type: gpt Disk identifier: 9DF9A9F1-0654-4E7A-9A5E-36E66D60FD79 Device Start End Sectors Size Type /dev/sdb1 2048 22527 20480 10M Linux filesystem /dev/sdb2 22528 43007 20480 10M Linux swap /dev/sdb3 43008 204766 161759 79M Linux filesystem nested (PMBR): # sfdisk --list --label-nested dos /dev/sdb ... Disklabel type: dos Disk identifier: 0x00000000 Device Boot Start End Sectors Size Id Type /dev/sdb1 1 204799 204799 100M ee GPT and for example: # sfdisk --label-nested dos /dev/sdb < --- disk-utils/sfdisk.8 | 4 ++++ disk-utils/sfdisk.c | 24 +++++++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/disk-utils/sfdisk.8 b/disk-utils/sfdisk.8 index 226fa3421..8f905174f 100644 --- a/disk-utils/sfdisk.8 +++ b/disk-utils/sfdisk.8 @@ -147,6 +147,10 @@ Specify disk label type (e.g. dos, gpt, ...). If no label specified then sfdisk defaults to an existing label. If there is no label on the device than defaults to "dos". .TP +.BR \-Y , " \-\-label-nested \fItype\fR +Force sfdisk to edit nested disk label. The primary disk label has to already exist. +This option allows to edit for example hybrid/protective MBR on devices with GPT. +.TP .BR \-h , " \-\-help" Display help text and exit. .TP diff --git a/disk-utils/sfdisk.c b/disk-utils/sfdisk.c index 7a5e8be8d..faaaf3fed 100644 --- a/disk-utils/sfdisk.c +++ b/disk-utils/sfdisk.c @@ -79,6 +79,7 @@ struct sfdisk { int act; /* action */ int partno; /* -N , default -1 */ const char *label; /* --label