Re: fdisk: off-by-one issue in (n)new command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 01/17/2012 07:07 AM, Karel Zak wrote:
On Mon, Jan 16, 2012 at 07:30:42PM -0300, Gerardo Exequiel Pozzi wrote:
Last sector, +sectors or +size{K,M,G} (2048-524287, default 524287): +255M
Value out of range.
  The size of the device is 268435456 bytes,

  +255M is relative to the begin of the partition, it means

     (2048 * 512) + (255 * 1024 * 1024) = 268435456 bytes
Right.

  but the begin of the last sector (in bytes) is

     268435456 - 512 = 268434944 bytes (LBA sector 524287)

  Right?
Right.

From [2048, 524287] (all inclusive), so

(524287 - 2048 + 1) * 512 = 522240  and 522240 * 512 / 2**20 = 255

Indeed, when you say, for example, these sizes: p1 = +55M, p2 = +100M, and now try to set +100M to p3, is not posible, so accept the default value, and you can see that the size is equal to p2, that is right. So the issue appears when last sector is specified in +sectors or +size(K|M|G), only


--
Gerardo Exequiel Pozzi
\cos^2\alpha + \sin^2\alpha = 1

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux