From: Chris Hofstaedtler <zeha@debian.org>
To: Thorsten Glaser <tg@mirbsd.de>, 1098638-quiet@bugs.debian.org
Cc: util-linux@vger.kernel.org
Subject: Re: Bug#1098638: fdisk: creates partitions one sector too large
Date: Sun, 23 Feb 2025 14:22:21 +0100 [thread overview]
Message-ID: <Z7shDWfLwHPMxT2C@per.namespace.at> (raw)
In-Reply-To: <5c513969-5e9f-cb0d-c62c-e153ca259915@mirbsd.de>
Control: tags -1 + upstream
Looping in upstream.
On Sat, Feb 22, 2025 at 12:57:38AM +0100, Thorsten Glaser wrote:
> Package: fdisk
> Version: 2.38.1-5+deb12u1
>
> When I create a new partition with +sectors, fdisk creates one
> that is one sector too large:
>
>
> Command (m for help): n
> Partition number (1-128, default 1):
> First sector (2048-7814037134, default 2048):
> Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-7814037134, default 7814035455): +2097152
>
> Created a new partition 1 of type 'Linux filesystem' and of size 1 GiB.
>
> Command (m for help): p
> Disk /dev/sdb: 3.64 TiB, 4000787030016 bytes, 7814037168 sectors
> Disk model: ST4000NM0245-1Z2
> Units: sectors of 1 * 512 = 512 bytes
> Sector size (logical/physical): 512 bytes / 4096 bytes
> I/O size (minimum/optimal): 4096 bytes / 4096 bytes
> Disklabel type: gpt
> Disk identifier: DDA88AFF-1E6A-7448-AB5A-85470938DBC7
>
> Device Start End Sectors Size Type
> /dev/sdb1 2048 2099200 2097153 1G Linux filesystem
Also from Thorsten:
> Same for MBR:
>
>
> Command (m for help): n
> Partition type
> p primary (0 primary, 0 extended, 4 free)
> e extended (container for logical partitions)
> Select (default p): p
> Partition number (1-4, default 1): 1
> First sector (2048-1000215215, default 2048):
> Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-1000215215, default 1000215215): +2048
>
> Created a new partition 1 of type 'Linux' and of size 1 MiB.
>
> Command (m for help): p
> Disk /dev/nvme0n1: 476.94 GiB, 512110190592 bytes, 1000215216 sectors
> Disk model: SAMSUNG MZVLB512HBJQ-00000
> 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: 0x3cca69b4
>
> Device Boot Start End Sectors Size Id Type
> /dev/nvme0n1p1 2048 4096 2049 1M 83 Linux
I've briefly reproduced this with util-linux 2.41-rc1 on a loopdev.
From what I understand Thorsten is saying, he would expect, for a
partition that starts at sector 2048, when its created with "+2048"
size, to have a number of 2048 sectors, not 2049 as shown above.
I haven't looked at the code if this is intentional or what the
reason could be.
Best,
Chris
next parent reply other threads:[~2025-02-23 13:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <5c513969-5e9f-cb0d-c62c-e153ca259915@mirbsd.de>
2025-02-23 13:22 ` Chris Hofstaedtler [this message]
2025-02-25 12:07 ` Bug#1098638: fdisk: creates partitions one sector too large Karel Zak
2025-02-26 9:22 ` Thorsten Glaser
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=Z7shDWfLwHPMxT2C@per.namespace.at \
--to=zeha@debian.org \
--cc=1098638-quiet@bugs.debian.org \
--cc=tg@mirbsd.de \
--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 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.