From: Ian Wienand <iwienand@redhat.com>
To: util-linux@vger.kernel.org
Subject: [PATCH] libfdisk: Detect out-of-space when adding new primary partition
Date: Thu, 8 Oct 2015 15:00:44 +1100 [thread overview]
Message-ID: <5615EA6C.8000801@redhat.com> (raw)
I got a bit confused with the interaction below:
Command (m for help): p
Disk /dev/sda: 41 GiB, 43965677568 bytes, 85870464 sectors
...
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 1026047 1024000 500M 83 Linux
/dev/sda2 1026048 85868543 84842496 40.5G 8e Linux LVM
Command (m for help): n
To create more partitions, first replace a primary with an extended partition.
I knew I should have had two primary partitions available, but I did
not notice that the disk was seen as full (I was trying to grow it)
This change detects available primary partitions, and if so indicates
we are out of space, rather than out of partitions.
Signed-off-by: Ian Wienand <iwienand@redhat.com>
---
libfdisk/src/dos.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/libfdisk/src/dos.c b/libfdisk/src/dos.c
index b337c0b..c04ee71 100644
--- a/libfdisk/src/dos.c
+++ b/libfdisk/src/dos.c
@@ -1598,8 +1598,11 @@ static int dos_add_partition(struct fdisk_context *cxt,
}
rc = add_logical(cxt, pa, &res);
} else {
+ if (free_primary)
+ fdisk_info(cxt, _("All space for primary partitions is in use."));
+ else
/* TRANSLATORS: Try to keep this within 80 characters. */
- fdisk_info(cxt, _("To create more partitions, first replace "
+ fdisk_info(cxt, _("To create more partitions, first replace "
"a primary with an extended partition."));
return -EINVAL;
}
--
2.4.3
next reply other threads:[~2015-10-08 4:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-08 4:00 Ian Wienand [this message]
2015-10-09 11:14 ` [PATCH] libfdisk: Detect out-of-space when adding new primary partition Karel Zak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5615EA6C.8000801@redhat.com \
--to=iwienand@redhat.com \
--cc=util-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox