Visit The New, Modern Unix Linux Community


Restoring back files from "lost+found" directory


 
Thread Tools Search this Thread
Special Forums Hardware Filesystems, Disks and Memory Restoring back files from "lost+found" directory
# 1  
Lightbulb Restoring back files from "lost+found" directory

Hi Friends,

How can I Restore the Files present under "lost+found" Directory of a FileSystem (in Solaris & Tru64 OS) to their original Locations.

[I know that files that go deferenced from the Filesystem in the aspect of INODES/BLOCK/etc get updated in the lost+found Directory of that FileSystem, when booting the system or manually doing FSCK on that FileSystem]

Now-a-days I am loosing lots of files in 2 of my Machines,
One running Solaris8 and other Tru64(Digital) Unix.

Thanx in Advance.....
# 2  
FYI - if you are losing files consistantly, then you may have bigger problems than worring about cleaning up lost+found. Check your /var/adm/message file and dmesg for errors on the drive(s).

Fix for Solaris:

Orphaned files and directories (allocated but not referenced) are placed
in lost+found during "fsck" operations. Files are named by the inode
reference "as found" by fsck. Files present in this directory are
inconsistent or badly injured.
Solution Summary Top

The File System Debugger (fsdb) utility is a straightforward although
not the most user friendly allowing the repair of file systems at a much
lower level than fsck. Great care must be taken when using fsdb,
absolute changes are being made to bowels of the file system.

A file "/lost+found/4224" at inode 3708 in the root file system will be
used in all examples. The inode of lost+found is 366.

Fsdb runs in two modes, interactive and command file. Both modes are
used. A command file with:

3708i
3708i.fd
q

The first line lists the inode data and the second lists the directory
entries. "q" indicates quit. Using this file makes it easier to
observe data as it will scroll by quickly in interactive mode.

Several data gathering steps should be followed prepartory to any
repairs.

1) "ls" command, "ls -ai 4224", and ls -i.
2) fsdb /dev/root <cmd >/tmp/out.tmp

Example 1:

"ls data"
ls -i
3807 4224
ls -ia 4224
366 .
3807 (

"out.tmp" file contents.

/dev/root(root): 1k byte Block File System
FSIZE = 65710, ISIZE = 16416
i#: 3807 md: d---rwxr-xr-x ln: 2 uid: 0 gid: 0 sz: 48
a0: 58951 a1: 0 a2: 0 a3: 0 a4: 0 a5: 0 a6: 0
a7: 0 a8: 0 a9: 0 a10: 0 a11: 0 a12: 0
at: Sat Jul 1 10:31:36 1995
mt: Mon Jul 3 11:26:16 1995
ct: Sat Jul 1 10:26:16 1995
d0: 366 .
d1: 2660 (
d2: 0
(out truncated)
d63: 0

The back reference entry (parent directory) was inode 2660. Main
problems are the back reference to the parent and the ".." entry.

To repair the directory the file and delete it

The steps to perform the task are:

1) Fix up the inode number by entering:
3807i.a0b.d1=3807
2) Fix dot-dot directory reference entry
d1.nm=".."
3) Enter q to quit.

4) Verify the directory entry by use of the fsdb cmd file sequence.

5) Use the "rmdir" command to remove the directory.

Example 1:

"ls data"
ls -i
3807 4224
ls -ia 4224
0 .
4967 (

"out.tmp" file contents.

/dev/root(root): 1k byte Block File System
FSIZE = 65710, ISIZE = 16416
i#: 3807 md: d---rwxr-xr-x ln: 2 uid: 0 gid: 0 sz: 48
a0: 58951 a1: 0 a2: 0 a3: 0 a4: 0 a5: 0 a6: 0
a7: 0 a8: 0 a9: 0 a10: 0 a11: 0 a12: 0
at: Sat Jul 1 10:31:36 1995
mt: Mon Jul 3 11:26:16 1995
ct: Sat Jul 1 10:26:16 1995
d0: 0 .
d1: 2660 (
d2: 0
d3: 3450 d a t a f i l e . d a t
(several other names)
(out truncated)
d63: 0

The back reference entry (parent directory) was inode 2660. Main
problems are the back reference to the parent, the self reference "."
and the ".." entry. There are many valuable data files here which
should be retained.

To repair the directory the file and delete it

The steps to perform the task are:

1) Fix up directory slot 1 inode number by entering:
3807i.a0b.d1=3807
2) Fix dot-dot directory reference entry
d1.nm=".."
3) Fix up directory slot 0 inode number by entering:
3807i.a0b.d0=3807
4) Fix dot directory reference entry
d0.nm="."
5) Enter q to quit.

6) Verify the directory entry by use of the fsdb cmd file sequence.

7) rename 2442 to a more significant name and back it up to a safe
location using a command similar to "tar -cvf safeplace name".

8) Use the "rmdir" command to remove the directory.

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #388
Difficulty: Medium
The Unix make command uses A.I. to maintain, update, and regenerate related programs and files.
True or False?

9 More Discussions You Might Find Interesting

1. AIX

Apache 2.4 directory cannot display "Last modified" "Size" "Description"

Hi 2 all, i have had AIX 7.2 :/# /usr/IBMAHS/bin/apachectl -v Server version: Apache/2.4.12 (Unix) Server built: May 25 2015 04:58:27 :/#:/# /usr/IBMAHS/bin/apachectl -M Loaded Modules: core_module (static) so_module (static) http_module (static) mpm_worker_module (static) ... (3 Replies)
Discussion started by: penchev
3 Replies

2. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

3. Shell Programming and Scripting

Delete all log files older than 10 day and whose first string of the first line is "MSH" or "<?xml"

Dear Ladies & Gents, I have a requirement to delete all the log files in /var/log/test directory that are older than 10 days and their first line begin with "MSH" or "<?xml" or "FHS". I've put together the following BASH script, but it's erroring out: for filename in $(find /var/log/test... (2 Replies)
Discussion started by: Hiroshi
2 Replies

4. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

5. Shell Programming and Scripting

"Join" or "Merge" more than 2 files into single output based on common key (column)

Hi All, I have working (Perl) code to combine 2 input files into a single output file using the join function that works to a point, but has the following limitations: 1. I am restrained to 2 input files only. 2. Only the "matched" fields are written out to the "matched" output file and... (1 Reply)
Discussion started by: Katabatic
1 Replies

6. Shell Programming and Scripting

Delete files older than "x" if directory size is greater than "y"

I wrote a script to delete files which are older than "x" days, if the size of the directory is greater than "y" #!/bin/bash du -hs $1 while read SIZE ENTRY do if ; then find $1 -mtime +$2 -exec rm -f {} \; echo "Files older than $2 days deleted" else echo "free Space available"... (4 Replies)
Discussion started by: JamesCarter
4 Replies

7. UNIX for Advanced & Expert Users

Why is wget copying my directory tree with some files with "@"?

I'm using wget 1.11.4 on Cygwin 1.5.25. I'm trying to recursively download a directory tree, which is the root of a javadoc tree. This is approximately the command line I tried: wget -x -p -r http://<host>/.../apidoc When it finished, it seemed like it downloaded... (0 Replies)
Discussion started by: dkarr
0 Replies

8. Shell Programming and Scripting

Copy files gives "cp: omitting directory" error

I tried to copy data from one location to multiple location my typing... cp <source> <dest> <dest> however this will omits one of the destination ... and proceed to copy to only one directory (2 Replies)
Discussion started by: dplate07
2 Replies

9. UNIX for Advanced & Expert Users

All alias in .profile lost when "script" command is called

Hi, I was trying to call "script <an ip add>" command from .profile file to log everything whenever anyone logs in to this user. I did the following at the end of .profile. 1) Extracted the IP address who logged in 2) Called script < ip add> . The problem I am facing is all, aliases etc. written... (3 Replies)
Discussion started by: amicon007
3 Replies

Featured Tech Videos