On Sun, May 22, 2011 at 03:02:09PM +0200, Otto Moerbeek wrote:
> On Sun, May 22, 2011 at 02:59:32PM +0200, Mark Kettenis wrote:
>
> > > Date: Sun, 22 May 2011 13:41:56 +0100
> > > From: Stuart Henderson <[email protected]>
> > >
> > > nice, I like this :-) OK sthen@.
> > >
> > > > (One thing that's needed is a smarter rounding to 4k boundaries, if
> > > > you work in units of M or G this works all out by itself, but above
> > > > you can see that the partitions after /var end up on a non-4k boundary
> > > > due to the relative 70% of free space change. Luckily this doesn't
> > > > matter at all for most disks)
> > >
> > > fwiw, all new desktop/notebook HD platforms produced after 1/1/2011
> > > (that's 1/1/2011 for USA folks with their strange date format) are
> > > supposed to be using 4K sectors.
> >
> > With emphasis on *supposed to* ;).
>
> Yep. Anyway, it isn't dificult to get the rounding right. But I'll
> get this in first,
>
> -Otto
And here's the diff for the correct aligning. Exactly the same as the
initial auto-layout. Update of help text as a bonus.
-Otto
Index: editor.c
===================================================================
RCS file: /cvs/src/sbin/disklabel/editor.c,v
retrieving revision 1.253
diff -u -p -r1.253 editor.c
--- editor.c 22 May 2011 13:04:40 -0000 1.253
+++ editor.c 22 May 2011 13:32:03 -0000
@@ -755,6 +755,7 @@ editor_resize(struct disklabel *lp, char
}
DL_SETPSIZE(pp, secs);
+ get_bsize(&label, partno);
/*
* Pack partitions above the resized partition, leaving unused
@@ -785,6 +786,7 @@ editor_resize(struct disklabel *lp, char
fputs("No room left for all partitions\n", stderr);
return;
}
+ get_bsize(&label, i);
prev = pp;
}
*lp = label;
@@ -1767,8 +1769,8 @@ editor_help(void)
" m [part] - modify partition\n"
"\n"
"Suffixes can be used to indicate units other than sectors:\n"
-"\t'b' (bytes), 'k' (kilobytes), 'm' (megabytes), 'g' (gigabytes)\n"
-"\t'c' (cylinders), '%' (% of total disk), '&' (% of free space).\n"
+" 'b' (bytes), 'k' (kilobytes), 'm' (megabytes), 'g' (gigabytes) 't'
(terabytes)\n"
+" 'c' (cylinders), '%' (% of total disk), '&' (% of free space).\n"
"Values in non-sector units are truncated to the nearest cylinder boundary.");
}