Re: Inode numbering

2008-10-22 Thread Polytropon
On Sun, 19 Oct 2008 19:18:00 -0700, [EMAIL PROTECTED] wrote:
 You may be able to reuse some code from dump(8).

Hey, that's a good idea! After having had a short look at the
source of dump, I developed another idea: dump applies some
criteria weather to access (and dump) an inode or not. Maybe
it's possible to change these criteria within dump, recompile
it and then use it to dump any (!) existing inode. The only
problem would be to implement a workaround for those that don't 
have a parent inode anymore (file name lost), i. e. those on
the 1st hierarchy stage within the home directory.



 Dump's purpose is to ensure that the dump will be complete in the
 sense of containing the full path to any file that is on the tape,
 and your purpose is different, but I suspect much of the find
 parent logic may be reusable.

I have to admit that it's a bit complicated. Programming applications
in C is my forte, hehe, but dump's C code is very much lowlevel.
I'm so lucky FreeBSD has the right attitude towards documentation.
So I will find a way to implement it, I hope.



-- 
Polytropon
From Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Inode numbering

2008-10-20 Thread Wojciech Puchar

Because I didn't find sufficient informations and try and error
would be incomplete (and insecure regarding the result), I'd like
to ask the following question:

Let's assume we have a directory D with an inode number i(D).
It contains a file F with its inode number i(F).

May I state that i(D)  i(F)?


usually but not always.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Inode numbering

2008-10-19 Thread Polytropon
On Sat, 18 Oct 2008 22:46:04 -0700, [EMAIL PROTECTED] wrote:
 It might work in the special case where nothing
 on the filesystem is ever moved or removed, and no hard links are
 ever added.
 
 As a simple example, suppose I have directories foo and foo/bar,
 and file foo/baz, with i(foo) == 15, i(foo/baz) == 20, and
 i(foo/bar) == 25, satisfying your criterion.  If I do
 
   mv foo/baz foo/bar
 
 (so baz is now foo/bar/baz), I will have i(foo/bar) == 25 and
 i(foo/bar/baz) == 20.

Thank you for this example. So I cannot assume inode
numbers to be in a specific order. It will force me to
do what I originally intended to do: Iterate from 2 up
to the maximal number and then check the availability,
and, if given, trace back the .. chain to an existing
directory entry point - or re-create one, if it is missing,
too. Will be a lot of work, but I think I can learn much
from this.

Remember, kids: Learning is fun. :-)


-- 
Polytropon
From Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Inode numbering

2008-10-19 Thread perryh
Polytropon [EMAIL PROTECTED] wrote:

 ... It will force me to
 do what I originally intended to do: Iterate from 2 up
 to the maximal number and then check the availability,
 and, if given, trace back the .. chain to an existing
 directory entry point - or re-create one, if it is missing,
 too. Will be a lot of work, but I think I can learn much
 from this.

You may be able to reuse some code from dump(8).

When doing an incremental dump, it reads through the inodes, makes
a list of those which are newer than the previous dump, then
recursively locates all parent directories of selected inodes and
adds them to the list.  (When doing a level 0 dump, it does the same
thing but by definition every inode is selected.)  Having done all
that, it dumps all the selected directories followed by the rest of
the selected inodes.

Dump's purpose is to ensure that the dump will be complete in the
sense of containing the full path to any file that is on the tape,
and your purpose is different, but I suspect much of the find
parent logic may be reusable.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Inode numbering

2008-10-18 Thread Polytropon
Hi!

Because I didn't find sufficient informations and try and error
would be incomplete (and insecure regarding the result), I'd like
to ask the following question:

Let's assume we have a directory D with an inode number i(D).
It contains a file F with its inode number i(F).

May I state that i(D)  i(F)?

I need to ask this in order to solve my data loss problem: I will
need to write a inode recovery program (having iintensive looks
at fsck_ffs' and fsdb's source code) to iterate over all the
inodes.

Maybe this additional question can be answered: Is there a mechanism
that output inode numbers according to a certain algorithm, or is
it random?

If I would try to check every imaginable inode nummer according to
the states connected, not connected - orphan or not connec-
ted - not used, could I iterate from 1 to the maximum of the
type ino_t, which is __uint32_t?

My idea is to trace back orphaned inodes by brute force because
fsck_ffs doesn't do the job, but similar to fsck_ffs, they will
be reconnected to the directory they originally have been gnereated
in, or in a kind of lost+found directory when the information from
the respective superstructure (e. g. file names) are lost. I may
assume that at least the inode of my former home directory has
gone away, so if everything else is still there (I have some
evidences from fsdb to assume this), after reconnecting everything
should be accessible. Only the file names from the first hierarchy
level (the files and subdirs directly within the home directory)
would change into #123456 as you know it from fsck_ffs' lost+found,
but the content inside the subdirs should still be present with
the original filenames - assumed that the corresonding inode
information structures are still complete.


Thanks for comments! And please tell me if there's already a
tool that does this! :-)

-- 
Polytropon
From Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Inode numbering

2008-10-18 Thread perryh
Polytropon [EMAIL PROTECTED] wrote:

 Let's assume we have a directory D with an inode number i(D).
 It contains a file F with its inode number i(F).

 May I state that i(D)  i(F)?

In general, no.  It might work in the special case where nothing
on the filesystem is ever moved or removed, and no hard links are
ever added.

As a simple example, suppose I have directories foo and foo/bar,
and file foo/baz, with i(foo) == 15, i(foo/baz) == 20, and
i(foo/bar) == 25, satisfying your criterion.  If I do

  mv foo/baz foo/bar

(so baz is now foo/bar/baz), I will have i(foo/bar) == 25 and
i(foo/bar/baz) == 20.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]