tech-userlevel archive

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

Re: disklabel(8) allows addressing non-existent space

On Mon, Jan 02, 2012 at 10:36:36PM +0100, Julio Merino wrote:
> On 1/2/12 9:47 PM, Mouse wrote:
> >>> Imho the current way of having to deal with an editor and a
> >>> calculator, or the interactive mode [...]
> >> Why do you need a calculator?
> > 
> > Well, I didn't write the double-quoted text above, but, speaking
> > personally, I'd want the calculator to do arithmetic like "I want this
> > partition to start 2^22 sectors before the start value printed here,
> > so...".  I don't have 2^22 memorized, and, while I could work it out
> > (hmm, a four times 1048576...41752^H304) and then do the arithmetic in
> > my head, I am less likely to make an error doing it with a calculator.
> > (Check that number above...okay, _that_'s why I want a calculator!)
> Sure.  My question was more rhetoric, like asking why you would need to
> calculate things manually when disklabel is already able to perform many
> common computations on its own (albeit not in a discoverable manner).
> > I'd still rather disklabel had a way to specify things like "this
> > partition should have this size and should end at the beginning of this
> > other partition", since then the chance of error is reduced even
> > further.  (Perhaps it can even do that these days.  I don't know; the
> > most recent disklabel I've tried to use is 5.1's.)
> It can do that, in interactive mode.  Within the editor, you are
> restricted to raw numbers AFAIK.

I find that the process of creating or modifying a disklabel usually
consists of some subset of the following steps:

1 read partitions from a label of type L for L in {GPT, MBR, BSD
  disklabel, Apple Partition Map, Sun label, ...}
2 create partition specifications (partition N: type T,
  absolute/relative/percentage/minimu/maximum offset and size)
3 specification satisfaction (calculator)
4 policy enforcement (e.g., partitions may not overlap, may begin on
  only X-byte boundaries, et cetera---part of step 3?)
5 record partitions to label of type L

Makes me wonder how many simple, reusable programs the process
decomposes into.


David Young    Urbana, IL    (217) 721-9981

Home | Main Index | Thread Index | Old Index