[Top][All Lists]

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

Re: parted script mode fails with unit option

From: Petr Uzel
Subject: Re: parted script mode fails with unit option
Date: Mon, 10 Oct 2011 16:11:07 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

On Sun, Oct 09, 2011 at 10:30:59PM +0530, Keshav P R wrote:
> Hi,
>      Parted in script mode (latest git snapshot) fails to  run when "unit MiB"
> is used (mainly for mkpart commands). I am planning to use similar commands in
> Archlinux installer script. Please check the attached file test_parted_unit.sh


If the user specifies position of start/end of the partition with
units like MB, kB, cyl and similar, parted is allowed to adjust the
specified start/end of the partition in some sensible range - IIRC
this is always half size of the unit in both directions. See the note
about IEC binary units in parted info page.

However, this 'feature' is disabled for following units: sectors, MiB,
GiB, and similar. Therefore, if you create the partition starting at
1 MiB and ending at 2 MiB, it will occupy sectors 1024-2048 (inclusive).

Following request to create partition from 2MiB to 202MiB fails,
because that would mean the starting sector (2048) would overlap with
the last sector of the first partition and parted is not allowed to
fix it.

I have just submitted a patch that makes the message more informative
by including exact partition geometry in sectors:

./parted/parted -s /dev/sdd unit MiB mkpart PART 2 3                            
Error: You requested a partition from 2.00MiB to 3.00MiB (sectors 2048 - 3072).
The closest location we can manage is 2.00MiB to 3.00MiB (sectors 2049 - 3072)

What might be even better solution is if the user specifies the _end_
in IEC units, the partition created by parted would actually end one
sector before.

- users would not run into this issue if using only IEC units
- no unnecessary gaps between partitions and alignment constraints
  still met (AFAIU we don't care if the partition end is aligned)
- partitions created using IEC units would also have size divisible by
  the unit (without the extra sector)

- yet another change of IEC units semantics
- different semantics for start and end
- more bytes to document it :)
- ???

What do you guys think? If this sounds good, I will submit a patch.



Petr Uzel
IRC: ptr_uzl @ freenode

Attachment: pgpKcJlYPCfUl.pgp
Description: PGP signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]