[OpenAFS-devel] Re: Question about AFSIDAT files, remake

Andrew Deason adeason@sinenomine.net
Tue, 20 Aug 2013 12:41:00 -0500


On Tue, 20 Aug 2013 18:17:07 +0200
Stefan Schnieber <stef@mailbox.tu-berlin.de> wrote:

> We hope to get some data back from the lost&found and the namei pathes 
> would be a great help.

You can't get the namei path from the AFS file path alone; the files
aren't stored that way. You need to know the FID of the file you want.
If you wanted to find out what the FID is, you need to look at the
directory object files and parse them, looking for the file. So you'd
need to look at every directory object in the path to the file. If the
file was at the path (relative to the volume root) ./foo/bar/file.txt;
you would need to look at 4 files ('.', 'foo', 'bar', and of course
'file.txt').

With all of that in mind, I can think of a few ways to maybe get what
you want:

 - The 'easiest' way to get files out would be to extract namei files
   for the whole volume. Then you can either put that directory
   structure on a real fileserver and access it via /afs like normal.
   
 - Or instead of putting the namei files on a real fileserver, you can
   use the tool 'voldump' to generate a 'vos dump'-like file from a
   namei dir tree, and then 'afsdump_extract' to extract the actual file
   hierarchy from the 'vos dump'.

 - If restoring all of the files for the volume is infeasible, you can
   use the other method mentioned above of looking at each directory
   blob and finding the next part of the path. For that, you can use
   afsdump_dirlist to parse the directory objects. Then you just need a
   way to transform a FID into a namei path. If you can't easily find a
   tool for that and you want to do this, just speak up and I can find
   something... there are many instances of this floating around.

 - As a slight alternative to the previous method, 'volinfo' can kind of
   translate fids to namei path names. If you restore all of the files
   under the per-volume 'special' directory, as well as the .vol header
   file, that should be enough to get 'volinfo' to work, if you put the
   files in a /vicepX directory.  Then you can use volinfo's -filenames
   option to print out the full path of each file all at once. I'm not
   sure if that will work, but volinfo shouldn't need anything besides
   the volume header files, so it seems like it should.

Those last two options will obviously require some scripting if you want
this automated in any way. But if you don't want that many files and if
they're not that "deep" in the hierarchy, it shouldn't be too bad to do
manually.

-- 
Andrew Deason
adeason@sinenomine.net