* [PATCH 0/1] libfdisk: allow to change an existing extended partition
@ 2017-04-18 15:59 Pavel Butsykin
2017-04-18 15:59 ` [PATCH 1/1] " Pavel Butsykin
0 siblings, 1 reply; 3+ messages in thread
From: Pavel Butsykin @ 2017-04-18 15:59 UTC (permalink / raw)
To: util-linux; +Cc: kzak, pbutsykin
The sfdisk utility does not allow us to change any extended partition type to
another extended type:
# sfdisk --list /dev/nbd0
Disk /dev/nbd0: 66 GiB, 70866960384 bytes, 138412032 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x006bf65f
Device Boot Start End Sectors Size Id Type
/dev/nbd0p1 * 2048 999423 997376 487M 83 Linux
/dev/nbd0p2 1001470 138412031 137410562 65,5G 5 Extended
# sfdisk --part-type /dev/nbd0 2 0x85
Extended partition already exists.
lt-sfdisk: /dev/nbd0: partition 2: failed to set partition type
But why? As far as I understand, this is done in order to avoid more than one
extented partition on MBR disk (because MBR doesn't support more). But since
extended partition there are three types:
#define IS_EXTENDED(i) \
((i) == MBR_DOS_EXTENDED_PARTITION \
|| (i) == MBR_W95_EXTENDED_PARTITION \
|| (i) == MBR_LINUX_EXTENDED_PARTITION)
It would be nice to have the option to change the type of an existing extended
partition.
Pavel Butsykin (1):
libfdisk: allow to change an existing extended partition
libfdisk/src/dos.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--
2.11.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/1] libfdisk: allow to change an existing extended partition
2017-04-18 15:59 [PATCH 0/1] libfdisk: allow to change an existing extended partition Pavel Butsykin
@ 2017-04-18 15:59 ` Pavel Butsykin
2017-04-19 8:26 ` Karel Zak
0 siblings, 1 reply; 3+ messages in thread
From: Pavel Butsykin @ 2017-04-18 15:59 UTC (permalink / raw)
To: util-linux; +Cc: kzak, pbutsykin
Signed-off-by: Pavel Butsykin <pbutsykin@virtuozzo.com>
---
libfdisk/src/dos.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libfdisk/src/dos.c b/libfdisk/src/dos.c
index 39e42e3e6..8f54f7369 100644
--- a/libfdisk/src/dos.c
+++ b/libfdisk/src/dos.c
@@ -2025,7 +2025,7 @@ static int dos_set_partition(struct fdisk_context *cxt, size_t n,
orgtype = p->sys_ind;
if (pa->type) {
- if (IS_EXTENDED(pa->type->code) && l->ext_offset) {
+ if (IS_EXTENDED(pa->type->code) && l->ext_offset && l->ext_index != n) {
fdisk_warnx(cxt, _("Extended partition already exists."));
return -EINVAL;
}
--
2.11.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] libfdisk: allow to change an existing extended partition
2017-04-18 15:59 ` [PATCH 1/1] " Pavel Butsykin
@ 2017-04-19 8:26 ` Karel Zak
0 siblings, 0 replies; 3+ messages in thread
From: Karel Zak @ 2017-04-19 8:26 UTC (permalink / raw)
To: Pavel Butsykin; +Cc: util-linux
On Tue, Apr 18, 2017 at 06:59:18PM +0300, Pavel Butsykin wrote:
> libfdisk/src/dos.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Applied, thanks!
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-04-19 8:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-18 15:59 [PATCH 0/1] libfdisk: allow to change an existing extended partition Pavel Butsykin
2017-04-18 15:59 ` [PATCH 1/1] " Pavel Butsykin
2017-04-19 8:26 ` Karel Zak
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.