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

Re: data recovery openoffice.sx? on ext3-partition



On Sep 05, 2002  09:16 -0400, Theodore Ts'o wrote:
> On Wed, Sep 04, 2002 at 06:30:00PM +0100, Stephen C. Tweedie wrote:
> > On Wed, Sep 04, 2002 at 07:03:12AM -0600, Andreas Dilger wrote:
> > > If desired, we could still do this operation in 2 stages:
> > > 1) mark inode unused in inode bitmap and nlinks = 0, put it on orphan list
> > > 2) update all of the block bitmaps and group descriptor summaries
> > > 
> > > If we crash between 1 & 2, we can always restart 2 like we do now.
> > 
> > Sure, but the problem is that 2) is also an unbounded operation that
> > can require multiple transactions, if it's a large enough file
> > covering enough block groups.

I guess a good thing is that the size of this transaction is probably
_much_ smaller than the "zap each indirect block" transaction, so we
might just try to allocate a transaction that big to start with.  For
huge or fragmented files it would fail, but for a large percentage it
would succeed.  It would also _dramatically_ increase the speed of
unlinking files because we would not be writing out so many blocks.

The difficulty, as you say, is to recover from a partial truncate in
a crash, because we still have to re-start the bitmap clearing.  This
_should_ be safe because we walk the orphan list before the filesystem
becomes available (so none of the blocks will have been re-allocated
to other files yet), so we could just re-start the truncate and "double
free" all of the bitmaps (as long as we don't double decrement the
group summaries, or mark the filesystem in error in this case (check
the ORPHAN flag in the inode for that)).

> It may be the only thing that makes sense is to keep a copy of the
> original i_blocks array, and then restore it after the truncate is
> complete and i_links is set to zero.  Even if we don't recover the
> indirect blocks, at least for small files people will be able to
> recover their data....

Also need to save the old i_size.

Cheers, Andreas
--
Andreas Dilger
http://www-mddsp.enel.ucalgary.ca/People/adilger/
http://sourceforge.net/projects/ext2resize/





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