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

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
  • 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. – Soumyadip DM 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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