bug-fdisk
[Top][All Lists]
Advanced

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

[bug-fdisk] Port parted's --align parameter (+patch)


From: Milko Krachounov
Subject: [bug-fdisk] Port parted's --align parameter (+patch)
Date: Wed, 9 Feb 2011 19:49:17 +0200
User-agent: KMail/1.13.5 (Linux/2.6.35-trunk-amd64; KDE/4.5.3; x86_64; ; )

Recent versions of parted have the following option:

  -a, --align=[none|cyl|min|opt]  alignment for new partitions

I have attached a patch that attempts to port this option to fdisk and cfdisk. 
It's a big patch, but I can attempt to split it up into smaller patches if it 
is required. Apart from adding the align option, it makes several crucial 
changes:

1. It makes query_part_position add the same fuzz to both the start and the 
end of the partition, and not only to the part that the user didn't "fix". An 
exception is made for resize where the fuzz is never added to the beginning, 
which is implemented by an additional UIOpts flag. This affects mainly cfdisk.
2. A bug in fuzzify is fixed (it ignored the end of the range when extending, 
thus shrinking the range to its start and making it lenght 1 as a side-effect).
3. I modified place_part_start and place_part_end (the functions that choose 
the best place for the start and end) to return aligned values, and removed 
the previous arbitrary fuzz that they added. I didn't, however, make the 
alignment respect logical partitions, and there is still a workaround in 
perform_mkpart, which I believe should also be fixed somehow.
4. The rest of the changes shouldn't affect the behaviour, except for my choice 
of default (see below), but since there are lot of edits at crucial points, 
I'd be wary and review the patch very carefully.

*WARNING* Since the alignment defaults to none, behaviour of fdisk is changed. 
I advice that if my patch gets applied, the default is switched to 
ALIGNMENT_CYLINDER. I forgot to change that before running hg diff.

I have tested the changes only with lfdisk and cfdisk, and I also couldn't run 
the test suite for some reason.

I also *propose* the following possible changes:
1. Make cfdisk and gfdisk default to optimal alignment.
2. Make gfdisk default to sectors, and not cylinders.
3. Remove checking for cylinder boundaries in gfdisk (it's currently broken, I 
can make a patch for it it is needed)
3. Possibly add '-c' option like util-linux fdisk (it disables DOS 
compatibility mode, but this mode is deprecated in util-linux fdisk any way).
4. What about adding a field in either the list or the additional info for 
cfdisk (and fdisk) that the user can use to see which partitions aren't 
aligned?

Attachment: alignment_option_and_updates.patch
Description: Text Data

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

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