Side thought: This issue has likely been addressed by business-grade disk optimization routines which, in the 80s, had to consider the possibility of a full or nearly-full disk and still function.

That's why I love throwing out these questions to wider audiences.

Many years ago whilst contracting at IBM, I was taken through the operational steps of what was one of, if not the, first defrag in situ utilities -- called 'vfrag' from memory -- by its author, in the company refectory. No paper or whiteboards, just knives and forks and (many) salt and pepper pots (much to the annoyance of other dinners).

And you are right, it did have similar problems. The initial, slow, but very reliable, version required just one block or maybe cluster of free-space, and shuffled everything through that one space.

The second, much faster version first consolidated the whitespace by shuffling up the in-use (discontiguous lumps) clusters starting from the front of the disc and working down, gradually accumulating the free-space clusters together and thus creating a bigger and bigger buffer into which to move the downstream chunks; until all the freespace was accumulated at the end of the disk.

Once done, the process of defragging the individual files became much simpler.

Unfortunately, I'm not sure it helps here as I have no free space within the buffers. Though I can use my small out-of-line buffer to create some, as described elsewhere.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". I'm with torvalds on this
In the absence of evidence, opinion is indistinguishable from prejudice. Agile (and TDD) debunked

In reply to Re^2: [OT] A measure of 'sortedness'? by BrowserUk
in thread [OT] A measure of 'sortedness'? by BrowserUk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.