xfs
[Top] [All Lists]

Re: undelete - xfsrecover'ing deleted files in xfs

To: Seth Mos <knuffie@xxxxxxxxx>
Subject: Re: undelete - xfsrecover'ing deleted files in xfs
From: Andi Kleen <ak@xxxxxxx>
Date: Fri, 1 Feb 2002 19:33:34 +0100
Cc: King Kac <kacperw@xxxxxxxxx>, linux-xfs@xxxxxxxxxxx
In-reply-to: <4.3.2.7.2.20020201185638.03660ee8@pop.xs4all.nl>
References: <4.3.2.7.2.20020201142828.037499a0@pop.xs4all.nl> <20020131210325.C966@comotion> <B87F3B30.17EF%gnydick@clubphoto.com> <4.3.2.7.2.20020201142828.037499a0@pop.xs4all.nl> <4.3.2.7.2.20020201185638.03660ee8@pop.xs4all.nl>
Sender: owner-linux-xfs@xxxxxxxxxxx
User-agent: Mutt/1.3.22.1i
On Fri, Feb 01, 2002 at 07:01:38PM +0100, Seth Mos wrote:
> When you delete a file the space that you freed is mostly contigous and 
> thus easily reused for the next file you create.

If you have enough space left there is nothing that would force reuse
of that same space directly afterwards. You could be lucky. 

When you can find the inode of the deleted file again and its extent btrees 
are not destroyed it should be possible to reconnect it to a directory.
XFS inodes are allocated in chunks of 64 so unless you free a lot of files
it is not too unlikely that such a chunk is not completely freed because
there is an inode left on it. With that information and some sanity checking
it may be possible to write a lsdel function for xfs_db that lists 
all free inodes in existing chunks that do not look like garbage. When they
can be inserted into the inode btree again and xfs_repair is run they
should should appear in lost+found. Of course this assumes that there
hasn't been that much new IO on the new fs afterwards and doesn't cover
all cases, but may be useful for some situations. 

Just an idea. I don't know how difficult it would be to write
an "is this inode garbage" function or to teach xfs_db to insert into
btrees (later is probably non trivial).

-Andi


<Prev in Thread] Current Thread [Next in Thread>