LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 07-16-2002, 11:46 PM   #1
udayan
Member
 
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.
regards
udayan

 
Old 07-17-2002, 02:43 AM   #2
Mik
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, 12:58 AM   #3
ashish_pathak
LQ Newbie
 
Registered: Sep 2003
Posts: 4

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

file -s /dev/hda*

Thanks,
-Ashish.
 
  


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 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 04:40 AM
Couldn't find matching filesystem ashesh Linux - General 2 05-23-2004 01:18 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
filesystem and device name udayan Programming 2 06-27-2002 09:50 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:45 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