LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-27-2006, 09:07 PM   #1
V@no
LQ Newbie
 
Registered: Oct 2003
Posts: 11

Rep: Reputation: 0
Directory shows as "unknown type" - any way to recover it?


Hello!
For unknown reason some files/directories on hard drive are not accessible anymore. If I do ls -l /full/path/ the corrupted directory shows like:
Code:
drwxr-xr-x 12 user user 16384 2006-04-17 22:56 name_of_good_directory
?---------  ? ?    ?        ?                ? /full/path/name_of_bad_directory
Is there a way to restore/recover these corrupted directories/files?

I've already checked the hard drive on possible sector loss or such - nothing wrong with it...

System info:
OS: Ubuntu 6.06
Kernel: 2.6.15-27-386
Filesystem: ext3
Hard drive connected via PCI Promise ATA100 controller

Thank you!

Last edited by V@no; 09-27-2006 at 09:13 PM.
 
Old 09-27-2006, 10:02 PM   #2
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
If this is on your boot partition then you should force an fsck during the next reboot as follows:
Code:
root> shutdown -fr now
If it is on a partition other than the boot partition then unmount the partition and run fsck on the device mapping in the /dev directory as in /dev/hda3.
 
Old 09-27-2006, 11:50 PM   #3
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD, Raspbian, Arch
Posts: 2,331

Rep: Reputation: 357Reputation: 357Reputation: 357Reputation: 357
This may just be a permissions problem on the directory, not corruption. A directory that is readable, but not executable, gives you strange results when you try to list it's contents.

Here's an example I just tried on my own system. The "corruption" shows up when I give the directory a weird 444 mode. The "corruption" dissappears when I change it back to a more reasonable 555 permission.
Code:
$ mkdir dir1
$ ls -l dir1
total 0
$ > dir1/file1
$ ls -l dir1
total 0
-rw-r--r-- 1 david david 0 2006-09-27 22:46 file1
$ chmod 444 dir1
$ ls -l dir1
total 0
?--------- ? ? ? ?                ? dir1/file1
$ chmod 555 dir1
$ ls -l dir1
total 0
-rw-r--r-- 1 david david 0 2006-09-27 22:46 file1
$
 
Old 09-27-2006, 11:57 PM   #4
V@no
LQ Newbie
 
Registered: Oct 2003
Posts: 11

Original Poster
Rep: Reputation: 0
Thanks for the replies.

Unfortunately its not permission issue...I just ran fsck and it indeed found some problems with these folders/files...Though I did answer "no" when it asked me to repair them, because I'm afraid by doing that I might lose the files completely...
Should I continue repair it with fsck or there is a better way to recover the files?

Thank you.
 
Old 09-28-2006, 08:01 AM   #5
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
If fsck finds files with problems it will put those files in the lost+found directory at the top of the partition's file system. Chances are that these files will not have their original name. Also, they may only be fragments of the original files.

I would try haertig's idea.
Code:
root> chmod 777 bad-directory
If that doesn't fix it then you can try to see how the directory is stored on the disk using the stat utility.
Code:
root> mkdir tmp
root> stat tmp
  File: `tmp'
  Size: 48              Blocks: 0          IO Block: 4096   directory
Device: 301h/769d       Inode: 275987      Links: 2
Access: (0700/drwx------)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2006-09-28 09:11:41.000000000 -0400
Modify: 2006-09-28 09:11:41.000000000 -0400
Change: 2006-09-28 09:11:41.000000000 -0400
root>
That might be useful if I knew of a tool that would fix a file based on that information, but I don't.

Otherwise I don't know of any other method of getting into that bad directory prior to using fsck.

Last edited by stress_junkie; 09-28-2006 at 08:16 AM.
 
Old 09-28-2006, 09:23 AM   #6
brainiac
Member
 
Registered: Jan 2005
Location: middle of a cornfield, IL
Distribution: Kanotix HD Install, Debian Testing, XP Pro,Vista RC1
Posts: 145

Rep: Reputation: 15
Have a look at testdisk. I had a partition that came up unknown, large storage partition, and test disk fixed it for me. I never did figure out why Debian or XP Pro could not "see" it, it was there, just unrecognizable.
 
Old 09-28-2006, 09:46 AM   #7
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
Quote:
Originally Posted by brainiac
Have a look at testdisk. I had a partition that came up unknown, large storage partition, and test disk fixed it for me. I never did figure out why Debian or XP Pro could not "see" it, it was there, just unrecognizable.
I'm a big fan of test disk myself. I don't think it applies here, though. This is a problem of an unreadable directory inside a good file system. Test disk fixes partition tables.
http://www.cgsecurity.org/wiki/TestDisk_Download
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
"FATAL: Unknown capture source type" error from Kismet atlantanewbie Linux - Wireless Networking 2 04-03-2010 05:34 AM
nmap and service type "unknown" Woodsman Slackware 8 08-26-2006 07:30 PM
"rm -rf /tmp", now Evolution shows "(no folder displayed" Ed-MtnBiker Linux - Software 7 04-10-2006 04:05 PM
Problems with mounting "unknown file system type 'ntfs' " turalo Fedora 2 12-21-2005 05:04 PM
ls pci shows "Subsystem: Intel Corp.: Unknown device 1011" hugle Linux - Software 0 07-10-2004 02:11 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:39 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration