Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

It's my mounted directory that I want to restore folder ostani. It contains many PHP, CSS, Javascript, etc. files. How can I access it? I use dd_rhelper to create an image and tried to fsck to repair it. But it's remove corrupted folder.

root@asgharserver:~# ls -la /root/oldhard/
ls: /root/oldhard/bina: Input/output error
ls: cannot access /root/oldhard/ostani: Input/output error
total 1187011436
drwxr-xr-x  26 root      root            4096 Jan  3 00:56 .
drwx------   4 root      root            4096 Jan 11 12:20 ..
drwxr-xr-x   2      1007      1007       4096 Aug 19 14:14 afshin
?--------- 512       512  33554432 2256582144 Jan 24  1971 bina
drwxr-xr-x   6 superuser superuser       4096 Nov 15 07:15 mahalleha
d?????????   ? ?         ?                  ?            ? ostani
drwxr-xr-x   2      1012      1012       4096 Aug 26 08:15 tvasr
share|improve this question
add comment

1 Answer

Looks like the inode information for the ostani dir is corrupted. However, the actual data might be just fine.

If so, you can use debugfs to recover this. Unmount the hard drive and proceed.

debugfs -c /dev/sdNP     #  replace N and P with the hard disk letter and partition
                         #  the -c option opens the filesystem in read-only mode without looking for inode information

# At the debugfs prompt do the following
ls -l                    #  this lists down the dir/file
rdump ostani  /tmp       #  this saves the recovered data of ostani dir to /tmp/ostani
share|improve this answer
    
ty but i cant find any file in ostani. check output. paste.ubuntu.com/1521226 –  sweb Jan 11 '13 at 23:07
    
You are not doing it correctly. From inside of debugfs you cannot cd into a directory as debugfs sees that as a file with directory entry. Once you are inside debugfs, just run rdump ostani /destination/dir/. All of the contents, along with ostani directory will be restored as it is recursive in nature. –  adminxor Jan 12 '13 at 15:00
    
i do that's also check my paste. debugfs: rdump ostani /home/backup/ line 5. it's not work after press enter nothing happened and show me new entry line. without any load and process time. –  sweb Jan 12 '13 at 15:06
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.