1 |
Thanks for the detailed advice. And thanks, Richard for your advice too. |
2 |
|
3 |
In the end (before I received your posts) I managed to move all the |
4 |
files into enough smaller directories that I could browse them in |
5 |
Nautilus. From what I saw it looked very much to me like most of the |
6 |
files were ones that had been deleted by emerge before the big disaster. |
7 |
I didn't look at every single one obviously, but it soon became obvious |
8 |
that I wasn't going to find much of any use. |
9 |
|
10 |
And thanks for giving a practical example of how to use find. I have |
11 |
always found the man page rather heavy going, so this is the first time |
12 |
I have felt I have half an idea how to use it. |
13 |
|
14 |
Robert |
15 |
|
16 |
On Tue, 2006-26-09 at 08:20 -0500, Boyd Stephen Smith Jr. wrote: |
17 |
> On Monday 25 September 2006 22:55, Robert Persson <ireneshusband@×××××.com> |
18 |
> wrote about '[gentoo-user] I have 146,000 files in lost+found. How do I |
19 |
> sort them?': |
20 |
> > Am I likely to find many usable files in that /lost+found directory? |
21 |
> |
22 |
> Maybe. I tried to recover a corrupted ext3 boot recently and was unable to |
23 |
> pull anything useful out of lost and found that was larger than a |
24 |
> symlink. :( If a number of files NOT in lost+found were corrupt, it's |
25 |
> likely most of the files in lost+found are corrupt as well. |
26 |
> |
27 |
> That said, /boot data is generally easy to replace, so I put no effort into |
28 |
> recovering files that were corrupted. If the data was valuable, if might |
29 |
> be worth it to spend some time sorting those out. |
30 |
> |
31 |
> > If I can, how can I best sift through them? |
32 |
> |
33 |
> Carefully. :) |
34 |
> |
35 |
> > Is there a utility, or |
36 |
> > something I could drop into a simple bash script, that would look at the |
37 |
> > first few bytes of the file and, say, identify it as a jpeg or an xml |
38 |
> > file, so that it could be given an appropriate file extension, deleted |
39 |
> > or moved? |
40 |
> |
41 |
> As the other poster mentioned, the file utility is useful for identifying |
42 |
> the type of file. Keep in mind though that is only looks at the first few |
43 |
> bytes of the file, if there's corruption later on file won't notice. |
44 |
> |
45 |
> > Or is there one that could distinguish a text file from a |
46 |
> > binary? |
47 |
> |
48 |
> Of course, file does this to some extent. A MIME type of text/* is |
49 |
> generally text, while anything else is binary. But, file's output (by |
50 |
> default) isn't a simple "binary" or "text" string. |
51 |
> |
52 |
> Some of the GNU utilities that are meant for text files will complain |
53 |
> before operating on a binary file, so you could use those for this task, |
54 |
> possibly. (I'm thinking of less and grep.) In particular, |
55 |
> grep '[^[:print:]]' should return true when run against a file that |
56 |
> contains non-printable characters (like control characters or NUL, and, |
57 |
> depending on locale, non-7-bit-clean characters). |
58 |
> |
59 |
> > Are there any other strategies I could use to sift through these files |
60 |
> > (assuming it would be worth doing)? |
61 |
> |
62 |
> Well, before you write some sort of bash script around file to rename |
63 |
> stuff, you'll probably want to remove anything that is clearly trash, like |
64 |
> device nodes or 0-length files. Something like: |
65 |
> find lost+found \! \( -type f -o -type d \ -o -type l \) -o -empty -delete |
66 |
> should work if you are using GNU find. |
67 |
> |
68 |
|
69 |
-- |
70 |
gentoo-user@g.o mailing list |