Help answer threads with 0 replies.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 07-17-2002, 12:46 AM   #1
Registered: Apr 2002
Location: India
Distribution: Linux Redhat 7.0
Posts: 62

Rep: Reputation: 16
Wink find the filesystem on device?

hi how can i find the filesystem on particular device. Ex. I have a device on my Redhat Linux 7.0 /dev/hda1 ... but how can i know which filesystem does it has. Is there any command for this.

Old 07-17-2002, 03:43 AM   #2
Senior Member
Registered: Dec 2001
Location: The Netherlands
Distribution: Ubuntu
Posts: 1,316

Rep: Reputation: 47
Well since most of them are listed in /etc/fstab anyway. I suppose something as simple as the following command could get you a quick answer:

grep /dev/hda1 /etc/fstab | awk '{print $3}'

Or if it's mounted anyway you could do something like:

grep /dev/hda1 /proc/mounts | awk '{print $3}'

If that isn't enough then you would probably have to read the first (or first few sectors) and try to recognize the filesystem type. I think fsck does something like this so you could look into the code to see how it's done there.
Old 09-26-2003, 01:58 AM   #3
LQ Newbie
Registered: Sep 2003
Posts: 4

Rep: Reputation: 0
You can use following command to see filesystem type: -

file -s /dev/hda*



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
how can i find out which filesystem a computer uses? kpachopoulos Linux - Newbie 2 11-12-2005 05:40 AM
Couldn't find matching filesystem ashesh Linux - General 2 05-23-2004 02:18 AM
Knoppix can't find filesystem ro3l Linux - Newbie 1 12-02-2002 08:04 PM
How do I find filesystem type sykkn Linux - General 4 08-21-2002 02:10 AM
filesystem and device name udayan Programming 2 06-27-2002 10:50 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:14 AM.

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