LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 07-15-2006, 07:32 AM   #1
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,393
Blog Entries: 1

Rep: Reputation: 63
how to find out which is the underlying filesystem


Dear fellows,

I am trying to help a friend of mine which has a defective disk with information he wants to recover from.

He replaced this disk for a new one, several months ago, and reinstalled the system in the new disk and never used the old disk again.

He is not an expert in linux, and he is not sure what filesystem was installed in the old disk.

The disk is damaged, I don't know how bad, but at least I can say the first superblock is damaged.
So, running reiserfsck on this disk I got "reiserfs superblock cannot be found on /dev/hdd1~ and running e2fsck, "e2fsck: Bad magic number in super-block while trying to open /dev/hdd1"

The question is: How to find which is the underlying filesystem on this partition ? Whith the right answer, I could use the proper tools to try to fix it, but I don't know which is: reiser v3, reiser v4, ext2, ext3, xfs, who knows ?

Any ideas ?

Last edited by marozsas; 07-15-2006 at 07:33 AM.
 
Old 07-15-2006, 07:36 AM   #2
spooon
Senior Member
 
Registered: Aug 2005
Posts: 1,755

Rep: Reputation: 48
how about
Code:
fdisk -l
 
Old 07-15-2006, 07:53 AM   #3
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,393
Blog Entries: 1

Original Poster
Rep: Reputation: 63
You missed the point. I don't want to know what partition type it is. It is Linux 83. I want to know what filesystem type it has.
 
Old 07-15-2006, 08:02 AM   #4
reddazz
Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 73
Code:
#cat /etc/fstab
or
Code:
#cat /proc/mounts
This is ok for disks that you have mounted on your system. If you need to check a disk thats not mounted yet, then I suggest you try using parted e.g.
Code:
#parted /dev/hdb print
You can also use gparted or qtparted if you prefer a GUI. Type 83 should be reisrfs.

Last edited by reddazz; 07-15-2006 at 08:10 AM.
 
Old 07-15-2006, 08:32 AM   #5
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,393
Blog Entries: 1

Original Poster
Rep: Reputation: 63
I can't read the the disk, because I can't mount it, because I can't fix it. So reading /etc/fstab is not a option. reading /proc/mounts neither because the disk won't mount. And type 83 is not only for reiser. Type 83 is good for ext2, ext3, reiser, xfs...
 
Old 07-15-2006, 09:19 AM   #6
reddazz
Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 73
Quote:
Originally Posted by marozsas
I can't read the the disk, because I can't mount it, because I can't fix it. So reading /etc/fstab is not a option. reading /proc/mounts neither because the disk won't mount. And type 83 is not only for reiser. Type 83 is good for ext2, ext3, reiser, xfs...
Thanks for the correction. If you read my post above, you will note that I said "cat /proc/filesytems" and "cat /etc/fstab" are for mounted drives. I also gave you a way to read the partitions on drives that are not mounted using parted. If I run "parted /dev/hdb", I get the following output
Code:
root@musasa:~ # parted /dev/hdb print
Disk geometry for /dev/hdb: 0kB - 80GB
Disk label type: msdos
Number  Start   End     Size    Type      File system  Flags
1       32kB    19GB    19GB    primary                boot, type=a5
2       19GB    32GB    13GB    primary   reiserfs     type=a6
3       32GB    46GB    13GB    primary                type=bf
4       46GB    67GB    22GB    extended               lba, type=0f
5       46GB    54GB    7970MB  logical   reiserfs     type=83
6       54GB    67GB    14GB    logical   reiserfs     type=83
Information: Don't forget to update /etc/fstab, if necessary.

root@musasa:~ #
/dev/hdb is not mounted and I am accessing this info from an OS installed on /dev/hda.
 
Old 07-15-2006, 09:42 AM   #7
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,393
Blog Entries: 1

Original Poster
Rep: Reputation: 63
Hey reddazz ! thanks for your time !

Sorry, parted provides nothing.
Code:
[root@iron ~]# parted /dev/hdd print
Disk geometry for /dev/hdd: 0kB - 80GB
Disk label type: msdos
Number  Start   End     Size    Type      File system  Flags
1       32kB    80GB    80GB    primary
Information: Don't forget to update /etc/fstab, if necessary.

[root@iron ~]#
gparted only display useful information of a good (I mean, not corrupted) filesystem.
I think it make sanity checks on the filesystem and only display information if has a minimum of integrity.

I was thinking if we could guess the filesystem type, based on a magic number in partition, much like the file command does.....
 
Old 07-15-2006, 11:32 AM   #8
reddazz
Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 73
I am sure if the filesystem was corrupt, parted would at least tell you what type it is. I think your drive is severely damaged and there may be a very low chance of retrieving any data on it. If it has really important data, then maybe some disk repair specialists maybe able to help you.
 
Old 07-17-2006, 01:03 PM   #9
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,393
Blog Entries: 1

Original Poster
Rep: Reputation: 63
Thumbs up Solved

And the answer is....."file" !

For my surprise, the command "file" could identify a file system by its magic number, no matter how bad is the filesystem structure. (of course, it can not be so damaged that the magic number is corrupted)

The only trick is to use the "s" flag, otherwise it will tell you it is a block device.

Code:
[root@gold ~]# file /dev/hdd1
/dev/hdd1: block special (1/1)
[root@gold ~]# file -s /dev/hdd1
/dev/hdd1: Linux rev 1.0 ext3 filesystem data (needs journal recovery) (large files)
[root@gold ~]#
Now I am sure the filesystem is ext3 and I could use the ext2/ext3 tools to try to recover the filesystem.
 
Old 07-17-2006, 04:20 PM   #10
reddazz
Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 73
Good for you. I didn't know that command could be used with disks. I will have to remember it since it may come in handy one day.
 
Old 07-17-2006, 04:59 PM   #11
MasterC
Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu
Posts: 12,612

Rep: Reputation: 64
That's pretty good info from both of you! I definitely could have used that a few days ago... Instead I just fdisk'd mkfs'd and installed a new distro on the drive since I figured it was a toasted filesystem, and the data wasn't *that* important. Oh well, the upside is that I was able to juggle data around and change all my / partitions to ext3, and then all the 'extra' partitions (home, var..) to xfs across my entire network (all what, 4 PC's ). Thanks, I'll definitely use this info at some point.

Cool
 
Old 07-19-2006, 08:03 PM   #12
Sören Schneider
Member
 
Registered: Apr 2005
Location: Brazil
Distribution: SUSE 9.0 Pro, SUSE OSS 10.0, KDE 3.4.2
Posts: 156

Rep: Reputation: 30
Try the Suse-partitioner and see if you can see and mount the HDD.
 
  


Reply

Tags
filesystem, identify


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't find KNOPPIX filesystem lees DamnSmallLinux 3 05-23-2006 05:55 AM
how can i find out which filesystem a computer uses? kpachopoulos Linux - Newbie 2 11-12-2005 04:40 AM
find the filesystem on device? udayan Programming 2 09-26-2003 12:58 AM
Knoppix can't find filesystem ro3l Linux - Newbie 1 12-02-2002 07:04 PM
How do I find filesystem type sykkn Linux - General 4 08-21-2002 01:10 AM


All times are GMT -5. The time now is 07:56 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration