Russell Cattelan wrote:
>
> Tim Clymo wrote:
>
> > At the risk of pushing the point here...
> >
> > I understand all that has been said about delayed writes, caches etc.
> > However, with regard to the original question in this thread, is it
> > still "expected behaviour" for the original source file to be full of
> > garbage if the system is powered off shortly after a non-synced write?
> >
> > Editing a plain text file for example with vi, saving the file and
> > doing an immediate reset - I could understand if the file was back to
> > its original state before the edit was "written", but my experience is
> > that instead it is useless junk.
>
> If you followed the thread and my last explanation you will note that the file
> was not full of garbage but NULL's. the file had no extents which means it
> consisted
> entirely of a whole aka NULL's
> As to why the contents of the file where not the 'old' data, most editors
> either
> mv the old copy to a backup name or truncate the file before writing to it.
> Effectively we are dealing with a "new" file and not one that is being
> "updated" or
> written over.
>
Indeed, this is the case: the original file contains NULL's
but the .swp file contains the correct contents, and in my case,
it included the modifications done < 1 sec before hitting the
power off button. So the solution is:
vi -r <file-name>
Does that work for you?
ananth.
--------------------------------------------------------------------------
Rajagopal Ananthanarayanan ("ananth")
Member Technical Staff, SGI.
--------------------------------------------------------------------------
|